ribice
September 8, 2019, 3:30pm
1
Per onedrawingperday ’s suggestion I’m posting here.
In short, the homepage doesn’t lost list of posts.
My theme kiss was updated with suggested changes from @onedrawingperday , but it still seems to be buggy using the latest version of hugo (0.58.0).
https://www.ribice.ba/
The index page is not build correctly, the blog pages are fine.
I just cloned your theme and the exampleSite almost works…you just need to add the line themesDir = "../.."
to config.toml
.
However, for your personal site, we’d need to see the code.
ribice
September 8, 2019, 9:13pm
3
I think you need to move your blog posts pages into a subdirectory under content
.
{{ partial "header" . }}
{{ partial "nav" . }}
<section class="section">
<div class="container">
{{ $pages := where site.RegularPages "Type" "in" site.Params.mainSections }}
{{ $paginator := .Paginate (where $pages "Params.hidden" "ne" true) }}
{{ range $paginator.Pages }}
<article>
<div class="subtitle tags is-6 is-pulled-right">
{{ if .Params.tags }}
{{ partial "tags" .Params.tags }}
{{ end }}
</div>
<h2 class="subtitle is-6 date">{{ .Date.Format "January 2, 2006" }}</h2>
<h1 class="title"><a href="{{ .Permalink }}">{{ .Title }}</a>{{ if .Draft }} ::Draft{{ end }}</h1>
Because your kiss theme ranges through Regular Pages which are in mainSections all the pages which are in the root of the /content
directory are ignored.
ribice
September 9, 2019, 4:58am
5
That did work but now all posts are under /posts/ URL, which I don’t like.
Previously it worked without that. What do I need to do in order to achieve it again?
Try using .Site.RegularPages
instead of mainSections in your list templates.
Or you could set the URL structure in your config.toml
file
Hugo supports permalinks, aliases, link canonicalization, and multiple options for handling relative vs absolute URLs.
ribice
September 9, 2019, 8:40am
8
I’ve tried this:
{{ $pages := where site.RegularPages "Type" "in" site.RegularPages }}
But the result is the same.
I’d rather avoid having to change the config.tom as it would mean a breaking change for theme users.
You are confusing Type which is an alias of Section with Hugo’s built in Page collections.
Please have a look at the Docs. There is a table that explains Hugo’s Page collections.
Also see the code sample posted in Hugo’s 0.57.2 release notes and the example provided in the themes repo issue about the broken page lists.