Hugothemes: New Theme - TwentyNineteen

Created on 17 Apr 2019  路  8Comments  路  Source: gohugoio/hugoThemes

Hi! This is my first, so please feel free to let me know if we need to fix or improve something. This is a port of WordPress's default TwentyNineteen theme.

https://github.com/jeremybise/twentynineteen-hugo

All 8 comments

Hello Jeremy,

thank you for porting Wordpress' default 2019 theme to Hugo. While reviewing your theme I noticed a few issues / spots for improvements:

  • the homepage only lists content files of type "post". You can make this more flexible by using Hugo's mainSections variable as follows:

    {{ $paginator := .Paginate (where site.RegularPages "Type" "in" site.Params.mainSections) }}

  • we can use a slightly modified version for the recent posts in the footer as well:

    {{ range first 5 (where site.RegularPages.ByPublishDate.Reverse "Type" "in" site.Params.mainSections) }}

  • please use .Site.BaseURL when linking the homepage in the footer. If a website is hosted in a subdirectory (like the themes demo), e.g. with www.example.com/blog/ the link would point to www.example.com. The same applies in the header
  • the path for the feature image in the demo points to a non-existing file. Is this behavior intended? You can always add an image in the static folder and link it.
  • right now, the main menu contains a link for the about page and another link called "About Hugo" that has a submenu which contains a link to the privacy policy. It's a bit confusing if a user sees ... About | About Hugo in the menu. Please reconfigure the menu such that it looks like ... About | Privacy Policy.
  • the search does work if the website is hosted in a subdirectory (as described in the aforementioned example) because the path to the search index is hard-coded to www.example.com/index.json. Could you change the Javascript so that you can use absURL as follows?

    $.getJSON({{ "/index.json" | absURL }} ...

Please let me know if you updated your theme or encountered any problems.

Thank you, good sir! I鈥檒l jump on your recommendations this weekend.

Hello, @digitalcraftsman. So I believe I've taken care of all points except the search feature in the example site. I did move the scripts into the template so I could use | absURL and that part is working locally. However, when I run the instructions to test the theme, when I run the search feature, I get a 404. I believe I had read that you don't use my content directory, right? The search page is dependent upon that search.md file in my example content folder. How do I approach that? Many thanks!!

Naturally it's the same answer as the other things you told me. LOL. Please hold.


Well, I believe I've got the search form going to the right place as well as the reference to the JSON file, but I haven't figured out how to overcome the 404 on /search in the demo.

Well, I believe I've got the search form going to the right place as well as the reference to the JSON file, but I haven't figured out how to overcome the 404 on /search in the demo.

I should have mentioned earlier that I already considered to white-list your theme. That allows you to use custom content for the demo. Otherwise I don't see a way to generate the search index. While testing your theme again the search worked well.

One minor issue that prevents Hugo from building the theme is that the identifier "Home" is used twice in the main menu. This happens because "Home" is linked in the config file in the content file for the homepage. Just remove one of the two to fix this problem.

Otherwise your theme looks fine.

Ah ha. That'll work. Thank you.

I went ahead and removed the menu frontmatter from the home page.

Woohoo! Then we're set to add your theme. It should appear soon on Hugo's theme site. Next, I'll promote your theme on Hugo's official Twitter account.

Many thanks, good sir. Your guidance and patience are appreciated.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

luizdepra picture luizdepra  路  4Comments

peaceiris picture peaceiris  路  4Comments

spech66 picture spech66  路  5Comments

kishaningithub picture kishaningithub  路  5Comments

EmielH picture EmielH  路  3Comments