Hope you can assist me with this issue. New to Hugo, and for the most part it is working great but, I am experience this strange issue where pages and the menu is built inconsistently. So, the site is very small, ~4 pages and I have the pages set-up as follows:
I then run hugo server -D and point the browser at localhost:1313. Now, sometimes the page content loads from index.md as expected, and the menu items are: home - about - portfolio - contact
Other times however the content from index.md is not, and the menu only has the entry for home
With regards to the menu specifically, I have the following in the frontmatter of all the pages:
linktitle: "home"
menu: "main"
What I also see is that, when the content is not loaded on the landing page(index.md), then trying to manually navigate to for example localhost:1313/pages/about results in a 404.
Not sure what is causing this inconsistency. Any idea, suggestions? I would really appreciate any help.
Also, just FYI. I have also tried running hugo server -D --disableFastRender as well as hugo server -D --disableFastRender --gc
Hi there – we’d need to see your site code in order to help you. Please see requesting help.
Just a guess, but this 404 is likely because you don’t have a single page template defined, e.g. layouts/_default/single.html. We would need to see your code to confirm, though.
Sometimes it does work just fine though. As mentioned, when the landing page at localhost:1313 loads the content from index.md, the menu is also correct, and the pages do load. Below is a screenshot of the theme directory:
Sorry, I’m unable to help you based off that screenshot. I’d need to see your actual code. If you can’t do that for some reason, at least provide a link to the theme you’re using.
Hello @schalkneethling, I ran into the same issue sometimes last week. I was able to solve the inconsistency by renaming content/index.md to content/_index.md.
It worked for me, perhaps it could work for you too.
So it solved part of the problem it seems i.e. The pages inside the pages folder now loads, and the navigation items are present. But now, the content from _index.md does not load on the landing page.
I thought perhaps I needed both a _index.md and index.md with the second containing the content, but that does not work either. Perhaps there is another way to define what the landing page should be when one load the root of the site i.e. localhost:1313
This is incorrect. The baseURL is fine, and should be the production URL, as it is – FYI when running hugo server locally, it makes the baseURL as http://localhost:1313/
Thanks zwebtz. Seems that my use of index.md then is correct. The content is still not showing up as the homepage though Is there some config I am missing?
In /goldratt_pl/layouts/index.html I added {{ .Content }} and the page content shows. Without that I am not sure how it would, so maybe you were changing that while developing.
Thanks @maiki - I was just looking at that, and it seemed to me like it was actually set-up to do some form of extracts and pagination. Basically like a blogs landing page. Let me try removing all that and replacing it with {{.Content }}