Guest User

Untitled

a guest
Nov 18th, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. 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).
  2.  
  3. 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).
  4.  
  5. Depending on what you want to show, this may be an option:
  6.  
  7. ```
  8. <div id="sidebar">
  9. {{ if .IsPage }}
  10. {{ range first 5 .Site.Pages.ByDate }}
  11. <h1><a href="{{ .Permalink }}">{{ .Title }}</a></h1>
  12. {{ end }}
  13. {{ else }}
  14. {{ range first 5 .Data.Pages.ByDate }}
  15. <h1><a href="{{ .Permalink }}">{{ .Title }}</a></h1>
  16. {{ end }}
  17. {{ end }}
  18. </div>
  19. ```
Add Comment
Please, Sign In to add comment