Skip to content

Instantly share code, notes, and snippets.

@danpoynor
Created August 18, 2020 11:46
Show Gist options
  • Save danpoynor/330422d56a32c68f8de7eab1d9618343 to your computer and use it in GitHub Desktop.
Save danpoynor/330422d56a32c68f8de7eab1d9618343 to your computer and use it in GitHub Desktop.
Get the first and last page in a Hugo subsection
{{ $subcat := (where .Site.Pages ".Params.section_title" "clients").ByTitle }}
{{ $firstItem := index $subcat 0 }}
{{ $lastItem := index $subcat (sub (len $subcat) 1) }}
<p>
First: {{ $firstItem.Title }}
<br>
Last: {{ $lastItem.Title }}
</p>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment