In the themes directory there are no layouts or anything, as I’m just using a “blank” theme. However when I have things setup this way, each of the individual pages: careers, contact, and about all render just like their single.html page template markup shows. The blog folder however has a list.html and single.html and when I run the localhost:1313/blog/ nothing shows at all. The refresh in the browser just spins and nothing is displayed.
I’ve tried a few things, like having an empty _default directory, which doesn’t seem to help. However if I setup the _default directory with a single.html and list.html file, then the blog uses those templates but the individual pages now use the _default/single.html template instead of the templates that are actually in their respective directories. I’ve read the docs @ https://gohugo.io/templates/content/ but I seem to be missing something still. Any thoughts on what the problem is here or how I should organize this?
This is what I suspected. Have you read through the docs?
So, index.md should be _index.md (with the underscore) and is technically a list page and not a single page.
Each of those folders is a section, so it’s probably an overkill if you are sure that you’re going to just have those few pages at the root. This is from the new docs concept site that is currently being developed, but the concepts are still accurate in the currently published gohugo.io as well:
I’m still a bit confused. If I change the index.md files to _index.md the behavior is still the same, which is each of those pages renders under http://thesite.com/about or http://theside/com/careers. But the blog section still doesn’t render at all even though I have a list.html and single.html template in place.
I read the docs and it appeared that if I have the layout have a section folder with a list.html and single.html each would respectively render the content section under that section. But it appears that this isn’t the case.
I’m going to try a few other things related to this and reread the docs again to see if I missed anything.
I got a bit bogged down yesterday and derailed. I’m back at it today trying to figure it out. I put the repo here for now so we can take a gander. The README.md has some info about how I’m using hugo to host the site, and I’m developing/attempting to get things working using just the regular hugo server and hugo server --buildDrafts right now, so nothing really out of the normal. All of the actual hugo code is all in the site directory within the repo. Thanks for taking a look!
Just cloned your repo. I’m a bit confused about what you’re doing here. Are you using the “blank” theme at all? When I remove the theme declaration from your config file altogether, the site seems to still render okay…
Do you even need this theme? I’m also seeing list.html and single.html with nothing in them but the word “nothing.”
So I think your best bet right now would be to do one of the following:
1. Move your about.md, careers.md, and contact.md into content/pages. Then in your config.toml add the following line:
pages = "/:slug/"
Without any further changes, these pages will render according to the layout you put at layouts/_default/single.html.
NOTE: Right now, you have about, contact, and careers set up as sections rather than individual pages. I’m making these suggestions assuming that you just want individual pages and that you are not going to be building multiple pages at content/about/*.md.
If you want to create specific layouts for each of them, you can declare a specific type and layout in the front matter. For example, from content/pages/about.md:
title = "About"
date = "2017-03-29T15:23:14-07:00"
tags = ["peloton", "about"]
type = "single"
layout = "about"
Note: These are just examples. You can name your type and layout whatever you want.
With the above front matter, Hugo will look for a layout for yoursite.com/about at layouts/single/about.html.
2. You could just move the three pages to content/about.md, content/contact.md, and content/careers.md, in which case all three will work their way through the lookup order that terminates at layouts/_default/single.html.
This is from the new docs concept, but I’d recommend reading through the following docs in the following order:
Between your two suggestions above, I did the following, with the TL;DR; that things now work.
I completed the things in the first suggestion above. But before I did that, I realized I was still running Hugo 0.17 so I decided to upgrade to 0.20. Once I did that, I completed the steps, and then ran the site.
The pages worked as you stated, and the blog worked without a glitch. I had run the blog just before upgrading and it blanked on on MacOS but not on the Linux machine I had, which both were running 0.17 before I upgraded. So whatever that glitch was, upgrading the Linux & MacOS machine to 0.20 completely eliminated the blog rendering problem.