mirror of https://github.com/theNewDynamic/gohugo-theme-ananke.git

Patrick Kollitsch
15.25.2026 3ad84196b30907c7a0ce7ae726c07df96e5b3cd4
feat: add page-index shortcode

Signed-off-by: Patrick Kollitsch <davidsneighbourdev+gh@gmail.com>
1 files added
19 ■■■■■ changed files
layouts/_shortcodes/page-index.html 19 ●●●●● patch | view | raw | blame | history
layouts/_shortcodes/page-index.html
New file
@@ -0,0 +1,19 @@
{{ $pagesBySection := site.RegularPages.GroupBy "Section" }}
{{ $sortedSections := slice }}
{{ range $pagesBySection }}
  {{ $sectionPage := page.GetPage .Key }}
  {{ $sortedSections = $sortedSections | append (dict "sectionPage" $sectionPage "pages" .Pages) }}
{{ end }}
{{ range sort $sortedSections "sectionPage.Weight" }}
  <h3>{{ .sectionPage.Title }}</h3>
  <ul>
      {{ range .pages }}
      <li>
        <a href="{{ .Permalink }}">{{ .Title }}</a>
      </li>
      {{ end }}
  </ul>
{{ end }}