Website links totally break upon minor changes

Hi there,

I’m just getting started with hugo and the initio theme. I’m running the server locally while I’m writing up the pages.

It feels like I’m gambling every time I add a character to a page. Reverting that change and even restarting the server does not guarantee that the website will load correctly again. Even removing the whole cache folder does not help! What the heck is going on?! Are the builds not reproducible?!

Update: I can confirm that the builds are not reproducible. To reproduce, just launch the server and open the sitemap.xml file (http://localhost:1313/sitemap.xml). I had one launch where the data was present. Then, stop the server (Ctrl+C) and remove the cache (rm -rf /tmp/hugo_cache/). Restart the server with the same version of hugo, and refresh the sitemap.xml page: all of the posts are gone. Awesome. The only work around I’ve found so far is to modify some at least one character in all of the pages that you really want on the site. This sure is going to be tedious!

Example 1: removing a commented line

For example, I just removed a commented line from the config.toml file and now the index.md front page won’t load anymore.

Going from:

[params]
    name = "Chris R..."
    description = "Blah blah"
    email = "myemail@email.com"
    # phone = "+234 23 9873237"
    # address = "234 Hidden Pond Road, Ashland City, TN 37015"
    # year = 2017
    # avatar = "images/guy.jpg"
    avatar = "gfx/diving2.jpg"
    avatarclass = "circle"

To (removing the commented line starting with #avatar):

 [params]
    name = "Chris R..."
    description = "Blah blah"
    email = "myemail@email.com"
    # phone = "+234 23 9873237"
    # address = "234 Hidden Pond Road, Ashland City, TN 37015"
    # year = 2017
    avatar = "gfx/diving2.jpg"
    avatarclass = "circle"

Causes the front page at / to not have any content but the menu, header and footer.

Example 2: adding a navigation link

For example, my config had the following:

[[menu.main]]
    name = "posts"
    url = "/post/"
    weight = 1
[[menu.main]]
    name = "publications"
    url = "/publications/"
    weight = 5

I changed it to the following

[[menu.main]]
    name = "home"
    url = "/"
    weight = 1
[[menu.main]]
    name = "posts"
    url = "/post/"
    weight = 2
[[menu.main]]
    name = "publications"
    url = "/publications/"
    weight = 5

And now, the link to “publications/” returns a 404. Moments earlier that link worked!

Additional notes

This is extremely frustrating. How can I solve this? Seriously considering using another tool for my site, wow.

  • I’m running the server as hugo serve --disableFastRender.
  • I’ve encountered this problem both with version 0.80.0 and 0.79.1
  • The content/publications folder has a _index.md which was working perfectly fine. And now, even reverting to a previous git commit does not solve the problem… so it seems that hugo is caching some built site somewhere.

Thanks

Perhaps you can share your repository with us. I built a new site with the hugo-initio theme and was unable to reproduce any of the problems you describe.

Sure, here is the full repo: Christopher Rabotin / chrisrabotin.me · GitLab .

You need to rename the top level “index.md” => “_index.md”.

1 Like

In doing so, the content from what’s in _index.md no longer shows. Is that expected? The rest of the content seems there.

Yes, that is expected. The theme’s home page template does not include {{ .Content }}.

To fix this:

mkdir layouts
cp themes/hugo-initio/layouts/index.html layouts/index.html

Then edit layouts/index.html and place {{ .Content }} somewhere.

1 Like

Could it be another file? This one does not seem to be called (event when modified in the theme itself): I’ve added some bolded red large text which should always be printed and it never shows.

Could it be another file?

No. Please update your repository and let us know when we can pull the updates to have another look.

Okay. The repo has been updated.

Move {{ .Content }} outside of the range loops, maybe right before </div> <!-- /container -->.

1 Like

Excellent, thank you both for your help. This seems to have solved my issues.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.