[Solved] Can't link/render posts in 'content/posts' in new theme from scratch

Hi there, I seem to have trouble linking posts in my template.

I placed test posts (copied from a theme) into ‘content/posts’ directory.

Then added to my config.toml as per in the URL Management docs.

  posts = "/:year/:month/:title/"

This is how the template looks like.

    {{ range after 1 .Pages.ByDate.Reverse }}
            <a href="{{ .Permalink }}" class="with-hover-effect">
                <span>{{ .Title }}</span>
                <span class="hover-bar"></span>
    {{ end }}

And I’m getting URLs like these which seems right but gives me 404s.


Edit: So, I quickly downloaded a random theme (minimal) and built the site, compared and noticed the issue. My theme doesn’t seem to be outputting any posts while the other theme had a ‘public > 2014’ folder.


Hugo version

Hugo Static Site Generator v0.55.0-DEV/extended windows/amd64 BuildDate: unknown


There was no error in the console even with --verbose, after an hour of looking and fiddling, turned out I needed at least some code in single.html for it to even render anything. I just threw in {{ .Content }} and worked from thereon.

1 Like