Files
winutil/docs/layouts/shortcodes/autolinks.html
T

20 lines
598 B
HTML
Raw Normal View History

2026-01-29 19:59:26 +00:00
{{- $section := .Get "section" | lower -}}
{{- $pages := slice -}}
{{- range .Site.RegularPages -}}
{{- if in .RelPermalink $section -}}
{{- $pageTitle := .Title -}}
{{- if eq $pageTitle "" -}}
{{- $pageTitle = .File.BaseFileName | humanize | title -}}
{{- end -}}
{{- if findRE "^# .+" .RawContent -}}
{{- $pageTitle = replaceRE "(?s)^# (.+?)\\n.*" "$1" .RawContent -}}
{{- end -}}
{{- $pages = $pages | append (dict "title" $pageTitle "url" .RelPermalink) -}}
{{- end -}}
{{- end -}}
<ul>
{{- range sort $pages "title" "asc" }}
<li><a href="{{ .url }}">{{ .title }}</a></li>
{{- end }}
</ul>