Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- But in general, it is important to understand that a Page in Hugo can be either a list page or a leaf page (leaf = no children).
- So when you do a `{{ range first 5 .Data.Pages.ByDate }}` you get a list of the pages that is a child of that page. For the home page, this is all the pages, for a section, it is the pages in that section etc. For a regular content page, there aren't any pages to show (no children).
- Depending on what you want to show, this may be an option:
- ```
- <div id="sidebar">
- {{ if .IsPage }}
- {{ range first 5 .Site.Pages.ByDate }}
- <h1><a href="{{ .Permalink }}">{{ .Title }}</a></h1>
- {{ end }}
- {{ else }}
- {{ range first 5 .Data.Pages.ByDate }}
- <h1><a href="{{ .Permalink }}">{{ .Title }}</a></h1>
- {{ end }}
- {{ end }}
- </div>
- ```
Add Comment
Please, Sign In to add comment