aboutsummaryrefslogtreecommitdiff
path: root/layouts/partials/document-view.html
diff options
context:
space:
mode:
authorRichard Qin <richard.qin.x@gmail.com>2026-08-08 21:30:23 +0800
committerRichard Qin <richard.qin.x@gmail.com>2026-08-08 21:30:23 +0800
commit4a5238e28715cc5a462f020b04d0f1226c972d90 (patch)
tree0893f99b5debe074f1596b6cfc6d3c86da34ca42 /layouts/partials/document-view.html
downloadrhomepage-4a5238e28715cc5a462f020b04d0f1226c972d90.tar.gz
rhomepage-4a5238e28715cc5a462f020b04d0f1226c972d90.tar.xz
Initialize personal website
Diffstat (limited to 'layouts/partials/document-view.html')
-rw-r--r--layouts/partials/document-view.html19
1 files changed, 19 insertions, 0 deletions
diff --git a/layouts/partials/document-view.html b/layouts/partials/document-view.html
new file mode 100644
index 0000000..5bfc7b6
--- /dev/null
+++ b/layouts/partials/document-view.html
@@ -0,0 +1,19 @@
+{{- if .File -}}
+ {{- $rawURL := "" -}}
+ {{- if .IsPage -}}
+ {{- $htmlBase := strings.TrimSuffix ".html" .RelPermalink -}}
+ {{- $rawURL = printf "%s/index.md" $htmlBase -}}
+ {{- else if .IsSection -}}
+ {{- $rawURL = printf "%s_index.md" .RelPermalink -}}
+ {{- end -}}
+ {{- $gitBase := strings.TrimSuffix "/" site.Params.gitBase -}}
+ {{- $gitURL := printf "%s/content/%s" $gitBase .File.Path -}}
+ <nav class="document-view" aria-label="Document formats">
+ <span>view:</span>
+ <a href="{{ .RelPermalink }}" aria-current="page">html</a>
+ <span aria-hidden="true">·</span>
+ <a href="{{ $rawURL }}">raw .md</a>
+ <span aria-hidden="true">·</span>
+ <a href="{{ $gitURL }}">git</a>
+ </nav>
+{{- end -}}