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.
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) }}
static folder and link it.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.