Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

menu-contextual.html 1.3KB

před 7 roky
123456789101112131415161718192021222324
  1. {{/* Get the current page's URL so we can compare it to the list below */}}
  2. {{ $currentPageUrl := .URL }}
  3. {{/* Get a list of this section's other pages. "RegularPages" excludes the list page */}}
  4. {{ $currentSection := (where .Site.RegularPages "Section" .Section) }}
  5. {{/* Get the number of entries of $currentSection and subtract 1 */}}
  6. {{ $i := sub ($currentSection | len) 1 }}
  7. {{/* So we can only show this menu if there are one or more other entries */}}
  8. {{ if ge $i 1 }}
  9. <aside class="bg-light-gray pa3">
  10. <ul>
  11. <li class="list b mb3">{{/* Return the section name, make it readable (humanize) and if there are 2 or more entries, make the section name plural (pluralize). */}}
  12. {{ $i }} More {{ if ge $i 2 }}{{ .Section | humanize | pluralize }}{{ else }}{{ .Section | humanize }}{{end}}
  13. </li>
  14. {{ range $currentSection }}
  15. <li class="list f5 w-100 hover-bg-white nl1">
  16. {{/* If the URL returned is the same as the current URL dim it so we know that that's the page we're on. NOTE: Should probably use a more accessible way of displaying this. */}}
  17. <a href="{{ .URL }}" class="link ph2 pv2 db black{{ if eq $currentPageUrl .URL }} o-50{{end}}">
  18. {{ .Title }}
  19. </a>
  20. </li>
  21. {{ end }}
  22. </ul>
  23. </aside>
  24. {{ end }}