mirror of
https://github.com/rustdesk/doc.rustdesk.com.git
synced 2026-04-10 09:46:13 +00:00
seo/geo
This commit is contained in:
21
layouts/partials/utils/toc-schema-items.html
Normal file
21
layouts/partials/utils/toc-schema-items.html
Normal file
@@ -0,0 +1,21 @@
|
||||
{{- $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 -}}
|
||||
Reference in New Issue
Block a user