All posts redirecting to home

Looks like my hugo blog is messed up. All posts are getting redirected to the home page (baseof.html that is). Tried a whole bunch of things to no avail.

Do you know of any known reasons (as usual mistakes one would make) for the above undesired behavior?

Thanks :pray:

If you need help, you should post more information. Preferably a link to your repository. And make sure baseUrl in your configuration points to the correct URL.

Honestly, I was trying to extract a small repo/sample from my original repo which unfortunately is a private one in the org. The sample did not have the problem. I thought this was a common mistake people make unknowingly.

Let me give it another try to create a sample repo demonstrating the problem.

@chrillek I managed to strip down to the bare minimum and have created a sample that demonstrates the problem. I think I have included other essential parts in the repo.

Steps I followed:

hugo new site sample
cd sample
hugo new theme clean

# Changed hugo.toml to hugo.yml. But it is still hugo.toml under ...sample/themes/clean.
# Update hugo.yml with `theme=clean`

hugo --cleanDestinationDir && hugo server
  • When you click on the blog link under the title on the page, you will see that it redirects to the same page even though it is linked to /posts.
  • I see that the content generated in the public/ folder for all pages have the content of the home page.

Obviously, I am missing something. Something is not interconnected right. My brain is frozen trying out different yet same set of things.

Any help is highly appreciated. :pray:

As I said: fix your baseURL in the configuration. It points to a bogus domain. Make it point to your base URL. This question is btw raised here at least once a week…

I am running this on my laptop (not in the cloud). Would it matter still? What would I update the baseURL to work on my machine (and in the cloud)? I understand it will be our domain name when running in the cloud. Not sure what it should be for running on my machine.

Your baseof.html template does not execute the others (home, single, and list).

See https://gohugo.io/functions/go-template/block/.

Yes … because the home page is the landing page with links (say blog, github etc.); like this:

<div class="home-content">
    <div id="title">Acme Knowledge Base</div>
    <div id="links">
      <a href="/posts">blog</a>
      <a href="https://github.com/johndoe">github</a>
      <a rel="me" href="https://mastodon.social/@johndoe">mastodon</a>
      <a href="/about/">about</a>
    </div>

I was expecting when I click on blog link above, it would take me to a page with posts (using the list.html layout). It is working so in another of our repos. This repo I am working stopped working (not sure exactly when)

Your expectations are incorrect. That’s not how the base/block construct works.