Files
doc.rustdesk.com/layouts/partials/utils/toc-schema-items.html
rustdesk 56cfd26e35 seo/geo
2026-03-20 18:42:55 +08:00

22 lines
819 B
HTML

{{- $page := . -}}
{{- $items := slice -}}
{{- $raw := $page.RawContent | default "" -}}
{{- if and (or $page.IsPage $page.IsSection) $raw -}}
{{- $raw = replaceRE "(?ms)```.*?```" "\n" $raw -}}
{{- range findRE `(?m)^#{2,3}\s+.+$` $raw -}}
{{- if lt (len $items) 12 -}}
{{- $rawLine := replaceRE `^#{2,3}\s+` "" . | markdownify | plainify | htmlUnescape | replaceRE "\\s+" " " | chomp -}}
{{- $line := partial "utils/clean-structured-label.html" $rawLine -}}
{{- if gt (len $line) 2 -}}
{{- $items = $items | append (dict
"@type" "ListItem"
"position" (add (len $items) 1)
"name" $line
"url" (printf "%s#%s" $page.Permalink ($rawLine | anchorize))
) -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- return $items -}}