How can I exclude certain categories from the homepage?
Hello everyone! I am in the process of migrating my blog from WordPress to Hugo, and I’ve encountered an issue.
I am using the hugo-theme-stack theme, and I want to exclude articles from two categories from appearing on the homepage. I have modified the layouts/index.html, but it doesn’t seem to be working. I also tried modifying the layouts/_default/list.html , but that didn’t work either.I have searched for a long time on the forum, but I haven’t found a suitable method.
layouts/index.html
{{ $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }}
{{ $notHidden := where .Site.RegularPages "Params.hidden" "!=" true }}
{{ $filtered := ($pages | intersect $notHidden) }}
{{ $pag := .Paginate ($filtered) }}
before
{{ $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }}
{{ $notHidden := where $pages "Params.hidden" "!=" true }}
{{ $filtered := where $notHidden ".Params.categories" "intersect" (slice "moments" "thinks") }}
{{ $pag := .Paginate ($filtered) }}
modifiled
thx!
7 posts - 3 participants