-
Notifications
You must be signed in to change notification settings - Fork 208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hiding a page from the posts list #19
Comments
FYI our site is here: https://github.com/NationalBankBelgium/opensource/tree/master and published on github pages from the "docs" folder. |
Hi @dsebastien, many thanks for your kind words. To hide some pages from the list in the homepage, you should carefully choose their content types. For instance, for my blog, I chose <div class="posts">
{{ range (where .Data.Pages "Type" "<>" "about").GroupBy "Section" }}
{{ range .Pages }}
<div class="post">
<h1 class="post-title"><a href="{{ .RelPermalink }}">{{ .Title }}</a></h1>
<span class="post-date">
{{ .Date.Format (.Site.Params.dateformat | default "Jan 02, 2006") }}
</span>
{{ .Summary }}
{{ if .Truncated }}
<div class="read-more-link">
<a href="{{ .RelPermalink }}">Read More…</a>
</div>
{{ end }}
</div>
{{ end }}
{{ end }}
</div> In case you want to exclude more types, then the syntax of <div class="posts">
{{ range (where .Data.Pages "Type" "not in" (slice "about" "portfolio")).GroupBy "Section" -}}
{{ range .Pages }}
<div class="post">
<h1 class="post-title"><a href="{{ .RelPermalink }}">{{ .Title }}</a>{{ if .Draft }}<sup> <i class="fas fa-pen-square fa-xs"></i></sup>{{ end }}</h1>
<span class="post-date">
{{- .Date.Format (.Site.Params.dateformat | default "Jan 02, 2006") -}}
</span>
{{ .Summary }}
{{- if .Truncated }}
<div class="read-more-link">
<a href="{{ .RelPermalink }}">Read More…</a>
</div>
{{- end }}
</div>
{{- end -}}
{{- end }}
</div> Hope this helps. |
I will close this issue for now. Please reopen or ask further questions as you wish. |
Hello,
Thanks for the nice theme.
I'm trying to hide a page from the posts list.
I've tried moving it out of the posts folder but it is still listed on the home page.
I've also tried adding "hidden: true" to the front matter, but it didn't go away either.
I'm not too sure I understand everything in here: https://discourse.gohugo.io/t/unwanted-pages-show-up-in-my-list-view/6656
But it looks like the theme should check for whether the hidden flag is set to true or false; is it done by this theme?
Any help is appreciated :)
The text was updated successfully, but these errors were encountered: