{{- define "headTpl" -}} {{- partial "head/preload-css" (dict "href" "https://download.pingcap.com/style/github-markdown.css") -}} {{- partial "head/preload-css" (dict "href" "/css/doc.css") -}} {{$.Scratch.Set "nav_active" "docs"}} {{$.Scratch.Set "data_i18_link" (print "/docs" (cond (isset .Params "cn") "-cn" "") "/") }} {{ $.Scratch.Set "metaTitle" "TiDB Documentation" }} {{- end -}} {{- define "main" -}} {{$.Scratch.Set "docs_stable_version" ""}} {{$.Scratch.Set "docs_type" ""}} {{$.Scratch.Set "docs_repo" ""}} {{$.Scratch.Set "title_prefix" ""}} {{$docs_total_versions := slice ""}} {{ if hasPrefix .RelPermalink "/docs/tidb-data-migration/" }} {{ $.Scratch.Add "docs_type" "tidb_data_migration" }} {{ $.Scratch.Add "docs_stable_version" ($.Scratch.Get "dm_stable_version") }} {{ $.Scratch.Add "docs_repo" "docs-dm"}} {{ $.Scratch.Add "title_prefix" "TiDB Data Migration" }} {{ $docs_total_versions = $docs_total_versions | append ($.Scratch.Get "dm_total_versions") }} {{ else if hasPrefix .RelPermalink "/docs/tidb-in-kubernetes/" }} {{ $.Scratch.Add "docs_type" "tidb_in_kubernetes"}} {{ $.Scratch.Add "docs_stable_version" ($.Scratch.Get "operator_stable_version") }} {{ $.Scratch.Add "docs_repo" "docs-tidb-operator"}} {{ $.Scratch.Add "title_prefix" "TiDB in Kubernetes" }} {{ $docs_total_versions = $docs_total_versions | append ($.Scratch.Get "operator_total_versions") }} {{ else }} {{ $.Scratch.Add "docs_type" "tidb" }} {{ $.Scratch.Add "docs_stable_version" ($.Scratch.Get "tidb_stable_version") }} {{ $.Scratch.Add "docs_repo" "docs"}} {{ $.Scratch.Add "title_prefix" "TiDB" }} {{ $docs_total_versions = $docs_total_versions | append ($.Scratch.Get "tidb_total_versions") }} {{ end }} {{ $current_version := default "stable" (index (findRE "(v\\d+\\.\\d+|dev|stable)" .RelPermalink) 0) }}
{{ if eq ($.Scratch.Get "docs_repo") "docs" }} {{ $.Scratch.Add "data_i18_link" (trim $current_version "/") }} {{ else }} {{ $.Scratch.Add "data_i18_link" (print (replace ($.Scratch.Get "docs_type") "_" "-") "/" $current_version )}} {{ end }} {{ $multi_level_url := cond (isset .Params "multi_level_url") .Params.multi_level_url ""}} {{ partial "navs/docs-nav.html" (dict "global" . "lang_prefix" "docs_" "cv" $current_version "sv" ($.Scratch.Get "docs_stable_version") "tv" $docs_total_versions "docs_type" ($.Scratch.Get "docs_type") "title_prefix" ($.Scratch.Get "title_prefix")) }}
{{- .Content -}}
{{ $file_prefix := print (cond (eq ($.Scratch.Get "docs_type") "tidb") "" (print ($.Scratch.Get "docs_type") "/")) $current_version }} {{- partial "archives/git-info.html" (dict "file_prefix" $file_prefix "docs_repo" ($.Scratch.Get "docs_repo") "docs_type" ($.Scratch.Get "docs_type") "global" . "sv" ($.Scratch.Get "docs_stable_version") "isCn" false "multi_level_url" $multi_level_url) -}}
{{- end -}} {{- define "footJS" -}} {{- end -}}