-
-
Notifications
You must be signed in to change notification settings - Fork 361
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
How do I remove or limit the post list on the homepage #34
Comments
I am also looking to figure this out! |
Sorry, I don't have time to answer your specific questions, but this theme has been explained line-by-line in the blogdown book: https://bookdown.org/yihui/blogdown/templates.html |
Here's small hack to get rid of it completely (option 3 in @zayuim original list)
{{ partial "header.html" . }}
{{if not .IsHome }}
<h1>{{ .Title | markdownify }}</h1>
{{ end }}
{{ .Content }}
{{if not .IsHome }}
<ul>
{{ range (where .Data.Pages "Section" "!=" "") }}
<li>
<span class="date">{{ .Date.Format "2006/01/02" }}</span>
<a href="{{ .URL }}">{{ .Title | markdownify }}</a>
</li>
{{ end }}
</ul>
{{ end }}
{{ partial "footer.html" . }} One thing I don't understand: How does Hugo decide which template to use, for each page? For example, how did Hugo decide that the first page would use the list.html template? |
To remove the list from the homepage, in hugo-xmin/layouts/_default/list.html , try : <ul>
{{ $pages := .Pages }}
{{ if .IsHome }}{{ $pages = .Site.RegularPages }}{{ end }}
{{ if not .IsHome}} <!-- add this line -->
{{ range (where $pages "Section" "!=" "") }}
<li>
<span class="date">{{ .Date.Format "2006/01/02" }}</span>
<a href="{{ .RelPermalink }}">{{ .Title | markdownify }}</a>
</li>
{{ end }}
{{ end }} <!-- add this line -->
</ul> |
@hongtaoh Thanks, I'll close the thread now. |
The homepage of an xmin Hugo site contains a list of all posts under all pages. I have some old posts that I don't want to display on the homepage, I was wondering if it was possible to...
I would want this to only affect the homepage's list and not to touch the pages own lists.
Thanks! :)
The text was updated successfully, but these errors were encountered: