This commit is contained in:
rustdesk
2026-03-20 18:42:55 +08:00
parent 1736869d5f
commit 56cfd26e35
463 changed files with 6538 additions and 62 deletions

View File

@@ -0,0 +1,26 @@
{{- $breadcrumb := false -}}
{{- $items := slice -}}
{{- if not .Params.disableBreadcrumb -}}
{{- range $index, $ancestor := .Ancestors.Reverse -}}
{{- $items = $items | append (dict
"@type" "ListItem"
"position" (add $index 1)
"name" $ancestor.Title
"item" $ancestor.Permalink
) -}}
{{- end -}}
{{- $items = $items | append (dict
"@type" "ListItem"
"position" (add (len $items) 1)
"name" .Title
"item" .Permalink
) -}}
{{- if gt (len $items) 1 -}}
{{- $breadcrumb = dict
"@type" "BreadcrumbList"
"@id" (printf "%s#breadcrumb" .Permalink)
"itemListElement" $items
-}}
{{- end -}}
{{- end -}}
{{- return $breadcrumb -}}

View File

@@ -0,0 +1,5 @@
{{- $label := . | default "" -}}
{{- $label = $label | markdownify | plainify | htmlUnescape | replaceRE "\\s+" " " | chomp -}}
{{- $label = replaceRE `^[0-9]+(?:\s*[.,::、)-]\s*|\s+)` "" $label -}}
{{- $label = replaceRE `^[A-Za-z](?:\s*[.)]\s*|\s+)` "" $label -}}
{{- return $label -}}

View File

@@ -0,0 +1,32 @@
{{- $items := slice -}}
{{- $raw := .RawContent | default "" -}}
{{- if $raw -}}
{{- $sections := after 1 (split (printf "\n%s" $raw) "\n## ") -}}
{{- range $sections -}}
{{- if lt (len $items) 8 -}}
{{- $section := printf "## %s" . -}}
{{- $lines := split $section "\n" -}}
{{- $question := replaceRE `^##\s+` "" (index $lines 0) | markdownify | plainify | htmlUnescape | replaceRE "\\s+" " " | chomp -}}
{{- if and $question (or (hasSuffix $question "?") (hasSuffix $question "")) -}}
{{- $answerRaw := delimit (after 1 $lines) "\n" -}}
{{- $answerRaw = replaceRE "(?ms)```.*?```" " " $answerRaw -}}
{{- $answerRaw = replaceRE `(?m)^!\[[^\n]*$` " " $answerRaw -}}
{{- $answerRaw = replaceRE `(?m)^\{\{%[^\n]*$` " " $answerRaw -}}
{{- $answerRaw = replaceRE `(?m)^\{\{<[^\n]*$` " " $answerRaw -}}
{{- $answerRaw = replaceRE `(?m)^-{3,}$` " " $answerRaw -}}
{{- $answer := $answerRaw | markdownify | plainify | htmlUnescape | replaceRE "\\s+" " " | chomp -}}
{{- if gt (len $answer) 40 -}}
{{- $items = $items | append (dict
"@type" "Question"
"name" $question
"acceptedAnswer" (dict
"@type" "Answer"
"text" (truncate 320 $answer)
)
) -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- return $items -}}

View File

@@ -0,0 +1,46 @@
{{- $page := . -}}
{{- $items := slice -}}
{{- $raw := $page.RawContent | default "" -}}
{{- if and $raw (not (in $page.RelPermalink "/faq/")) (not (in $page.RelPermalink "/strategy/")) -}}
{{- $sections := after 1 (split (printf "\n%s" $raw) "\n## ") -}}
{{- range $i, $sectionText := $sections -}}
{{- if lt (len $items) 3 -}}
{{- $section := printf "## %s" $sectionText -}}
{{- $lines := split $section "\n" -}}
{{- $name := replaceRE `^##\s+` "" (index $lines 0) | partial "utils/clean-structured-label.html" -}}
{{- if and $name (not (or (hasSuffix $name "?") (hasSuffix $name "") (in $name ","))) -}}
{{- $body := delimit (after 1 $lines) "\n" -}}
{{- $body = replaceRE "(?ms)```.*?```" " " $body -}}
{{- $body = replaceRE `(?m)^!\[[^\n]*$` " " $body -}}
{{- $body = replaceRE `(?m)^\{\{%[^\n]*$` " " $body -}}
{{- $body = replaceRE `(?m)^\{\{<[^\n]*$` " " $body -}}
{{- $stepsRaw := findRE `(?m)^\d+\.\s+.+$` $body -}}
{{- if ge (len $stepsRaw) 3 -}}
{{- $steps := slice -}}
{{- range $stepIndex, $stepRaw := first 8 $stepsRaw -}}
{{- $stepText := replaceRE `^\d+\.\s+` "" $stepRaw | markdownify | plainify | htmlUnescape | replaceRE "\\s+" " " | chomp -}}
{{- if gt (len $stepText) 10 -}}
{{- $steps = $steps | append (dict
"@type" "HowToStep"
"position" (add $stepIndex 1)
"name" (truncate 120 $stepText)
"text" $stepText
) -}}
{{- end -}}
{{- end -}}
{{- if ge (len $steps) 3 -}}
{{- $items = $items | append (dict
"@type" "HowTo"
"@id" (printf "%s#howto-%d" $page.Permalink (add (len $items) 1))
"name" $name
"url" $page.Permalink
"inLanguage" $page.Site.Language.Lang
"step" $steps
) -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- return $items -}}

View 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 -}}

View File

@@ -0,0 +1,46 @@
{{- $page := . -}}
{{- $items := slice -}}
{{- $seenIDs := slice -}}
{{- $raw := $page.RawContent | default "" -}}
{{- if $raw -}}
{{- $raw = replaceRE `\r?\n\]\(` `](` $raw -}}
{{- $currentHeading := $page.Title -}}
{{- range split $raw "\n" -}}
{{- $line := . -}}
{{- $headingMatch := findRESubmatch `^#{2,3}\s+(.+)$` $line -}}
{{- with $headingMatch -}}
{{- $currentHeading = index (index . 0) 1 | partial "utils/clean-structured-label.html" -}}
{{- end -}}
{{- $matches := findRESubmatch `\[(.*?)\]\((https?://(?:www\.)?(?:youtube\.com/watch\?v=[^)#\s]+|youtu\.be/[^)#\s]+)[^)]*)\)` $line -}}
{{- range $matches -}}
{{- if lt (len $items) 8 -}}
{{- $title := index . 1 | partial "utils/clean-structured-label.html" -}}
{{- $url := index . 2 | chomp -}}
{{- $videoID := "" -}}
{{- if in $url "youtu.be/" -}}
{{- $videoID = replaceRE `^.*youtu\.be/([^?&#/]+).*$` `$1` $url -}}
{{- else -}}
{{- $videoID = replaceRE `^.*[?&]v=([^?&#/]+).*$` `$1` $url -}}
{{- end -}}
{{- if or (not $title) (eq $title $url) (hasPrefix $title "http://") (hasPrefix $title "https://") -}}
{{- $title = $currentHeading | default $page.Title -}}
{{- end -}}
{{- if and $title $videoID (not (in $seenIDs $videoID)) -}}
{{- $seenIDs = $seenIDs | append $videoID -}}
{{- $items = $items | append (dict
"@type" "VideoObject"
"@id" (printf "%s#video-%s" $page.Permalink $videoID)
"name" $title
"url" $url
"embedUrl" (printf "https://www.youtube.com/embed/%s" $videoID)
"thumbnailUrl" (printf "https://i.ytimg.com/vi/%s/hqdefault.jpg" $videoID)
"inLanguage" $page.Site.Language.Lang
"isPartOf" (dict "@id" (printf "%s#webpage" $page.Permalink))
"publisher" (dict "@id" "https://rustdesk.com/#organization")
) -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- return $items -}}