Giter VIP home page Giter VIP logo

ghostwriter's Introduction

Ghostwriter

Enhanced port of the Ghost "ghostwriter" theme to the Hugo site generator.

Installation

Inside the folder of your Hugo site run:

$ mkdir themes
$ cd themes
$ git clone https://github.com/jbub/ghostwriter

For more information read the official setup guide of Hugo.

Development

After installing the theme you need to install javascript dependencies. You can use npm to install them from package.json. We are using webpack to build and package styles. In order to develop with realtime reloading in the browser you can use this powerful combo:

hugo server
npm run watch

To update theme styles edit the styles/style.scss file. You can then either use the watch command or run build to compile the styles:

npm run build

Example config.yml

To customize your theme you can use following params:

baseurl: "https://example.com/"
title: mytitle
theme: ghostwriter
languageCode: en-us
copyright: My Name
googleAnalytics: XXX
disqusShortname: XXX
pygmentsUseClasses: true
pygmentsCodefences: true

markup:
  highlight:
    codeFences: true
    guessSyntax: false
    hl_Lines: ""
    lineNoStart: 1
    lineNos: false
    lineNumbersInTable: true
    noClasses: true
    tabWidth: 2

privacy:
  disqus:
    disable: true
  googleAnalytics:
    anonymizeIP: true
    respectDoNotTrack: true
    useSessionStorage: false

author:
  name: My Name
  profile: ""

taxonomies:
  tag: tags

params:
  mainSections:
    - post
  intro: true
  headline: My headline
  description: My description
  github: "https://github.com/XXX"
  gitlab: "https://gitlab.com/XXX"
  linkedin: "https://linkedin.com/in/XXX/"
  twitter: "https://twitter.com/XXX"
  stackoverflow: "https://stackoverflow.com/users/XXX/YYY"
  facebook: "https://www.facebook.com/username"
  email: [email protected]
  opengraph: true
  shareTwitter: true
  rss: true
  shareFacebook: true
  shareLinkedIn: false
  dateFormat: "Mon, Jan 2, 2006"
  exponeaJsUrl: ""
  exponeaTarget: ""
  exponeaToken: ""
  exponeaTrackVisits: false
  readingTime: true
  readingTimeText: "Estimated reading time:"
  fathomUrl: ""
  fathomSiteId: ""
  plausibleAnalytics:
    domain: ""
    # Default value is plausible.io, overwrite this if you are self-hosting or using a custom domain
    serverURL: ""

permalinks:
  post: "/:year/:month/:day/:filename/"

menu:
  main:
    - name: Blog
      url: /
      weight: 1
    - name: Projects
      url: /project/
      weight: 2
    - name: Contact
      url: /page/contact/
      weight: 3
    - name: About
      url: /page/about/
      weight: 4

You can also inject arbitrary HTML into <head> simply by overriding the extra-in-head.html partial, which is meant for that purpose.

ghostwriter's People

Contributors

dechamps avatar dependabot[bot] avatar dylanhthomas avatar erickgnavar avatar fernandoguedes avatar g3d avatar gtskk avatar jbub avatar legends2k avatar matachi avatar mihneadb avatar nonumeros avatar peoray avatar romainx avatar roryg avatar simon-lifelike avatar tginsberg avatar tmo-github avatar tommorris avatar trhall avatar vabs avatar virot avatar zerob13 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ghostwriter's Issues

Error: Cannot find module 'perfectionist'

Hi,

This is the output of my yarn run watch command:

yarn run v1.17.3
$ webpack --progress --colors --watch
internal/modules/cjs/loader.js:775
throw err;
^

Error: Cannot find module 'perfectionist'
Require stack:

  • /Users/paulopinto/hugo/paulopinto.xyz/themes/ghostwiter/webpack.config.js
  • /Users/paulopinto/hugo/paulopinto.xyz/themes/ghostwiter/node_modules/webpack/bin/convert-argv.js
  • /Users/paulopinto/hugo/paulopinto.xyz/themes/ghostwiter/node_modules/webpack/bin/webpack.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:772:15)
    at Function.Module._load (internal/modules/cjs/loader.js:677:27)
    at Module.require (internal/modules/cjs/loader.js:830:19)
    at require (internal/modules/cjs/helpers.js:68:18)
    at Object. (/Users/paulopinto/hugo/paulopinto.xyz/themes/ghostwiter/webpack.config.js:2:23)
    at Module._compile (internal/modules/cjs/loader.js:936:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:947:10)
    at Module.load (internal/modules/cjs/loader.js:790:32)
    at Function.Module._load (internal/modules/cjs/loader.js:703:12)
    at Module.require (internal/modules/cjs/loader.js:830:19) {
    code: 'MODULE_NOT_FOUND',
    requireStack: [
    '/Users/paulopinto/hugo/paulopinto.xyz/themes/ghostwiter/webpack.config.js',
    '/Users/paulopinto/hugo/paulopinto.xyz/themes/ghostwiter/node_modules/webpack/bin/convert-argv.js',
    '/Users/paulopinto/hugo/paulopinto.xyz/themes/ghostwiter/node_modules/webpack/bin/webpack.js'
    ]
    }
    error Command failed with exit code 1.
    info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Gertting up and running..

Hi, just having some trouble getting up and running!
I ran npm install and npm run watch which seemed to do a tonne of stuff - but i don't have yarn do I need it?

Basically when I browse my site locally I see the following scripts failing to load because they don't exist:

localhost/:23 GET http://localhost:1313/dist/styles.css 
localhost/:665 GET http://localhost:1313/js/jquery.fitvids.js 
localhost/:664 GET http://localhost:1313/js/jquery-1.11.3.min.js 
localhost/:671 GET http://localhost:1313/js/scripts.js 
(index):664 GET http://localhost:1313/js/jquery-1.11.3.min.js 
(index):665 GET http://localhost:1313/js/jquery.fitvids.js 
(index):671 GET http://localhost:1313/js/scripts.js 

How can I get them created?

Editing the homepage

Editing layouts/index.html does not result in changes to the site's homepage but edits made to layouts/_default/list.html do.

Is there a way to change this so that I can control the homepage by editing layouts/index.html?

Logo display help

The partial for header.html appears to support a log entry, but I cannot get the logo to appear. I have added
logo="/img/logo.png" to [params] in config.toml and put the file in content/img
This results in site error

2022-01-28 09:57:29.630 +0000
ERROR 2022/01/28 09:57:29 render of "page" failed: execute of template failed: template: post/single.html:1:3: executing "post/single.html" at <partial "header.html" .>: error calling partial:

I hava also tried to explicitly edit img src in header.html.

Any help welcome. Other info on using logo in [params] is pretty vague as far as I can see

Thanks in advance

MathJax Support?

I'm attempting to code mathematics formulas on a blog page but my site is rendering those formulas out as a text string rather than a mathjax formula. For example, I am using this formula:

\hat{y}=\beta_1x+\beta_0

It gets rendered as a text string. I've attempted to use various types of math delimiters, like $...$ and (...) but that did not help. I added the mathjax script tag to the header partial file but that did not help. I even attempted a couple of different "mathjax = true" lines in the config.toml but that did not help.

Is there any way to render a math formula in a blog post?

The page with the bad math is located at: https://gself.com/2018/10/16/simple-regres/. A couple of paragraphs below the correlogram is this paragraph:

The general regression formula is (\hat{y}=\beta_1x+\beta_0) where the output ((\hat{y}) is determined by two parameters of the model ((\beta) and the input ((x). As an example, if (\beta_1) is 2 and (\beta_0) is 1 then an input ((x) of 1 would yield an output ((\hat{y}) of 3.

Thanks for any help you can offer.

Remove Google+

Google+ is no longer available so it should be removed from sharing, profile list, and configuration file.

Get the about.md page as intro

Hello!
I'm trying to modify this beautiful theme to display in my homepage the content of about.md, contained in content/about.md.

If my intuition is correct, I have to update the index.html webpage.
But, even after reading the tutorial about Hugo templates, I don't understand how to ask to the index.html file: "Please, read the content of about.md when the path is /".
Can somebody help me please? :-/

Thanks a lot!

Post footer not showing for articles in root content folder

I want to have my posts to show up as https://blog.peoray.com/hello-world instead of something like https://blog.peoray.com/a_folder_name/hello-world.

I remove the containing folders (Home, Tutorials, Personal) and also main.menu and also copied and pasted the articles I already have into the root content folder but viewing it on the browser, I noticed that the post-footer isn't showing (newsletter, tags, social media sharing and disqus)

How do I o about this and fixed it, I hardly know any Go to fix this

Link to repo

Logo display help

The partial for header.html appears to support a log entry, but I cannot get the logo to appear. I have added
logo=/img/logo.png to [params] in config.toml and put the file in static/img
I hava also tried to explicitly edit img src in header.html.

Any help welcome. Other info on using logo in [params] is pretty vague as far as I can see

Thanks in advance

Remove 'feed' icon on front page?

Hi there,
I can't find where in the theme we can edit the little 'feed' icon that seats right on the top center of the website. Whenever I click on it, it opens the News app on my mac. I have no use for it and would like to remove it completely, but don't know how. Thanks in advance.

Google Analytics implemented?

Hi, thanks for such a great theme. Is Google Analytics implemented? In the template file, of course, there is the googleAnalytics field, but if I understand correctly there need to be changes to the template field as well (as described here. I ask only because I added a Google Analytics tracking code, correctly, I hope, but don't seem to see it registering activity yet. Thanks for your consideration of this!

Security Issues

Github Security has discovered 5 serious vulnerability issues.

  • acorn
    Current Version: 6.4.0
    Remediation: Upgrade acorn to version 6.4.1 or above.

  • fstream
    Current Version: 1.0.10
    Remediation: Upgrade fstream to version 1.0.12 or above.

  • tar
    Current Version: < 2.2.0
    Remediation: Upgrade tar to version 2.2.2 or above.

  • sshpk
    Current Version: 1.10.1
    Latest Version: 1.16.1
    Remediation: Upgrade sshpk to version 1.13.2 or above.

  • lodash
    Current Version: < 4.17.12
    Remediation: Upgrade lodash to version 4.17.12 or above.

Don't know if it's everyone or just me facing this issue.

Move CSS/JS files to assets folder, use pipes, remove dist folder

Hello, thanks a lot for porting this theme to Hugo!

I found the dist folder in this repo. It's not a good solution in Hugo, I suggest to use Hugo pipes and remove the "dist" folder, it's a more clean and good solution to override code and make CSS/JS chunks, without editing theme files inside and rebuild with yarn.

More about Hugo pipes you can find here - https://regisphilibert.com/blog/2018/07/hugo-pipes-and-asset-processing-pipeline/

I can do refactoring and help with it! Waiting for your feedback. Thx!

Cleanup post-footer.html

Get rid of {{ if or (not (isset .Site.Params "sharetwitter")) .Site.Params.shareTwitter }} and use simple if conditions

Security issues with yarn.loc?

So everytime I update my blog, github has a ton of security complaints:
image

am I the only one? Or am I somehow missing a step?

Center Images

Hello I wish to centre some images and need to put the following code into the theme. But not sure where to put it. Perhaps it's worth putting it in as default?

http://www.ebadf.net/2016/10/19/centering-images-in-hugo/

img[src$='#center']
{
    display: block;
    margin: 0.7rem auto; /* you can replace the vertical '0.7rem' by
                            whatever floats your boat, but keep the
                            horizontal 'auto' for this to work */
    /* whatever else styles you fancy here */
}

img[src$='#floatleft']
{
    float:left;
    margin: 0.7rem;      /* this margin is totally up to you */
    /* whatever else styles you fancy here */
}

img[src$='#floatright']
{
    float:right;
    margin: 0.7rem;      /* this margin is totally up to you */
    /* whatever else styles you fancy here */
}

Footer elements alignment

Hi,

I noticed that the site title and scroll-to-top button aren't that well aligned in the footer:

screen shot 2017-01-06 at 23 20 42

I looked into it quickly, and didn't come up with any fix. Maybe you have better luck. Otherwise I will try to poke at it again when I have time.

Changing theme colours

Thanks for a great theme. I am new to Hugo and am trying to change the default font. I first considered the settings in the "Colours" section of style.scss, but changing these did not seem to change the appearance. Can you recommend how I can make changes to them?

Josh

Share links not mobile friendly and uses inline JS

In the post-footer.html partial template, the Twitter, Facebook, Google+, and LinkedIn options all attempt to open a window with a specific size:

<div class="share">
{{ if or (not (isset .Site.Params "sharetwitter")) .Site.Params.shareTwitter }}
<a class="icon-twitter" href="https://twitter.com/share?text={{ .Title }}&url={{ .Permalink }}"
onclick="window.open(this.href, 'twitter-share', 'width=550,height=235');return false;">
<i class="fa fa-twitter"></i>
<span class="hidden">Twitter</span>
</a>
{{ end }}
{{ if or (not (isset .Site.Params "sharefacebook")) .Site.Params.shareFacebook }}
<a class="icon-facebook" href="https://www.facebook.com/sharer/sharer.php?u={{ .Permalink }}"
onclick="window.open(this.href, 'facebook-share','width=580,height=296');return false;">
<i class="fa fa-facebook"></i>
<span class="hidden">Facebook</span>
</a>
{{ end }}
{{ if or (not (isset .Site.Params "sharegoogleplus")) .Site.Params.shareGooglePlus }}
<a class="icon-google-plus" href="https://plus.google.com/share?url={{ .Permalink }}"
onclick="window.open(this.href, 'google-plus-share', 'width=490,height=530');return false;">
<i class="fa fa-google-plus"></i>
<span class="hidden">Google+</span>
</a>
{{ end }}
{{ if .Site.Params.shareLinkedIn }}
<a class="icon-linkedin" href="https://www.linkedin.com/shareArticle?mini=true&title={{ .Title }}&url={{ .Permalink }}&summary={{ .Description }}"
onclick="window.open(this.href, 'linkedin-share', 'width=554,height=481');return false;">
<i class="fa fa-linkedin"></i>
<span class="hidden">LinkedIn</span>
</a>
{{ end }}
</div>

This does not work on mobile and might need to specifically call out about:blank as the target so that a new tab can be used.

Additionally, since the JS for the onclick event is inlined, a CSP that disables inline JS cannot be used. To make sites that use this theme more secure, the JS needs to be pulled into its own file(s) and then referenced in the page.

config.toml alternative to config.yaml

Hello, nice work with this theme. I noticed that the config is currently set to a YAML file and most params are quite simple to use.

I would like to know if the same work for config.toml, I did search but found no example usage of the same, perhaps this could be added to the exampleSite folder if such support exists. I'm currently using a .toml file which works but harder to customise.
EDIT
It seems that a .toml file was the original config according to this

Thank you,
Nelson

Site not building in Netlify

2:58:54 PM: Executing user command: hugo 2:58:54 PM: ERROR 2019/10/20 13:58:54 Failed to add template "partials/header.html" in path "partials/header.html": template: partials/header.html:10: function "hugo" not defined 2:58:54 PM: ERROR 2019/10/20 13:58:54 partials/header.html : template: partials/header.html:10: function "hugo" not defined 2:58:54 PM: Building sites … 2:58:54 PM: ERROR 2019/10/20 13:58:54 Error while rendering "page" in "post/": template: post/single.html:1:3: executing "post/single.html" at <partial "header.html...>: error calling partial: template: "partials/header.html" is an incomplete or empty template 2:58:54 PM: Skipping functions preparation step: no functions directory set

Tag Display Inconsistencies

I've noticed that if you create a page that displays all of the tags of your posts, there isn't a way to control the format of the list of tags (i.e. all uppercase/lowercase or as entered). Additionally, if you have a lot of tags, the page navigation between the pages references posts instead of tags.

I think it would be beneficial to allow for the tag display to be customized so that the case is uniform and for the navigation to say tags instead of posts.

Example:
tags

Support of cards... ?

Hi @jbub,

Thank you for your great job with this theme.

Just a question, do you think to support the Twitter cards and the equivalent of Facebook and other social networks?

Thank you and take care about you.

Stéphane

Link to headers?

Hi. Awesome theme. Is there a way to include links to headers within a page? Thanks!

multiple <header> elements on each page

there is a mixture of html5 semantic elements (multiple

s, ) but some are missing.
There is no nor does the main
have "role=main" applied.

This is an accessibility issue, but also a semantic one.

There is some schema markup using microdata, but this does not serve the same purpose.

Missing / in resource url when previewing on Netlify

When I deploy a branch preview on Netlify, the site using this theme does not look right because the CSS and JS resources from the theme are not found.

I believe this is because {{.Site.BaseURL}} is used, and it does not add missing trailing slash. I have one in my baseURL config but Netlify sets none when changing the base URL.

<link rel="stylesheet" href="{{ .Site.BaseURL }}dist/site.css">
<link rel="stylesheet" href="{{ .Site.BaseURL }}dist/syntax.css">

However, it seems that loading resource this way is not advice. See gohugoio/hugo#3262 (comment) where the maintainer of hugo advice the following

But manually creating URLs using {{ .Site.BaseURL }} is fragile, esp. for themes, and not recommended. Use absURL and friends, and you should not have to worry about slashes.

Using relURL or absURL would be better I believe.

This fix the issue I encounter if I tweak the theme. But there are a lot of occurrences in the theme of this.
I think this should be fixed as the theme level.

Does this cause any issue with anyone in the past ?

Page displayed in posts list

I am trying to add an about page, that can be accessed from the main menu, but it appears on the main page in the posts list. The page file is located in "content/page/about.md". Is there a way to hide it from posts list?

Is it possible to have dropdown menu ?

Hi I want to have the dropdown menu on my site using your theme. I want something like following.
image

My config.toml file looks like following:

baseurl = "/"
relativeurls = true
languageCode = "en-us"
title = "Jd's Notebook"
paginate = 10
theme = "ghostwriter"
googleAnalytics = ""
disqusShortname = ""
ignoreFiles = ["\.Rmd$", "_files$", "_cache$"]

[permalinks]
post = "/:year/:month/:day/:slug/"

[[menu.main]]
name = "About"
url = "/about/"
[[menu.main]]
name = "Github Configuration"
url = "/github-configuration/index.html"
[[menu.main]]
name = "Twitter"
url = "https://twitter.com/janeshdev"
[[menu.main]]
name = "Github"
url = "https://github.com/janeshdev"
[[menu.main]]
name = "DSI Posts"
url = "/tags/dsi/"

[taxonomies]
category = "categories"
tag = "tags"

[params]
description = "Janesh Devkota's personal notebook"

# options for highlight.js (version, additional languages, and theme)
highlightjsVersion = "9.9.0"
highlightjsLang = ["r", "yaml"]
highlightjsTheme = "github"

I don't want to change the position of the menu. It will be the default menu that is on the top of the website.

In simple words, I was wondering if I could add few items under About in the menu.

Pygments, responsive

If you use pygmentize for server side syntax highlighting, currently this overflows horizontally on the page.

image

If its a simple fix i'll submit a PR

Change main page

Dear Juraj, thanks for the theme.
I am trying to change the content of the main page of a website with ghostwriter. I noticed the main page has the content under 'post', but I would like that to be only under one of the other main menus (in my case, I have a main menu called tutorials where I will have the posts).
But I don't know how to change that in the config file. I would like the front page of the site to be a page called Home, which could be the main menu with weight 1, and add some blurb there, but not posts. Where can I put some markdown text to go in the initial page?
Hope it's not too confusing.
Thanks!

Cannot activate menu system through config file

Hello,

I have been trying to use the menu system for the ghostwriter theme with no success. I have followed the example in the config.yml, but have placed square brackets around the name of the parameter since this is how it works with when using config.toml file for Netlify. This is how I did it and it did not work:

[menu]
  [main]
     name: "Blog"
      url: "/"
      weight: 1

How would I go about implementing the menu system correctly?

Thanks

Some questions about author, slug and documentation

Thank you for this wonderful theme: simple but very functional! I am relatively new to Hugo so I have some questions:

  • the name of the author in the header of .md files does not work for me. The theme takes always the name I have put in under [Author] in the config.toml. It overwrites all names in the headers in the .md files.

  • project files do not have authors. Is this intended? I believe there it would more important than in the blog, as projects are normally done cooperatively and one should mention all participants.

  • how can I change the slug? Is it always the filename? This means I have to create a post with a good filename in mind and later -- if I change the focus/subject of the title, what happens many times -- to rename title (easy) and the file name (not so easy). The file name IMHO Is not important for readers as it is not seen, but the URL should transport some idea about the content of the post).

  • is there a place where I can get some information what variables and metadata in the header of the posts/projects of your theme are allowed? I would need some kind of a primer …

  • and last not least: I was surprised that the live site generated a comment form by Disqus. I left the disqusShortname = "XXX", e.g. I did not provide my Disqus short name.

(I was using ghostwriter with blogdown 0.1, hugo 0.27.1 and employed it via GitHub with Netlify.)

feature request

Hi jbub - great theme! I request for a few bits of additional functionality:

  • LinkedIn per-post sharing (needed in addition to Twitter & Facebook per-post sharing)

  • Inclusion of a YAML-specified image in per-post share content (text only shares get little attention on social media!)

  • filtering view of blog posts titles by category and/or tag

Please let me know what you think of these proposed features!

Thank you Jbub!!!

Code formatting

Hello is it possible to have code formatting like so? Rather than using four spaces?

```python{4}
def foo():
x = 1
y = 2
z = 3
```

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.