Duplicate Section Page (for reverse order view)?

50 views
Skip to first unread message

loads...@gmail.com

unread,
Sep 17, 2014, 11:45:50 PM9/17/14
to hugo-d...@googlegroups.com

How would I display an additional page for a specific Section? The section displays by {{ range .Data.Pages.ByWeight }} and I need an additional page on the website that displays the same section information but by {{ range .Data.Pages.ByWeight.Reverse }}.

Nate Finch

unread,
Sep 18, 2014, 3:08:17 PM9/18/14
to hugo-d...@googlegroups.com
This is a little ugly, but should work.  Make another directory under content that has the name of the url you want, so like content/namereverse/   add a piece of content there (I believe hugo won't make the list directory unless there's content).

Then make a layouts/section/namereverse.html for the reverse section, and just do {{ range .Site.Sections.namereverse.Pages.ByWeight.Reverse }}

I haven't actually tried out that the template is exactly right, but I think it should be pretty close.

loads...@gmail.com

unread,
Sep 18, 2014, 11:35:41 PM9/18/14
to hugo-d...@googlegroups.com

This works like a charm Nate, so in my eyes, it's beautiful. Thank you [again].
Reply all
Reply to author
Forward
0 new messages