We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3ca34b9 commit e38d549Copy full SHA for e38d549
layouts/shortcodes/example.html
@@ -0,0 +1,14 @@
1
+{{ $file := .Get "file" }}
2
+{{ $codelang := .Get "language" | default (path.Ext $file | strings.TrimPrefix ".") }}
3
+{{ $fileDir := path.Split $file }}
4
+{{ $bundlePath := path.Join .Page.File.Dir $fileDir.Dir }}
5
+{{ $filename := printf "/content/%s/examples/%s" .Page.Lang $file | safeURL }}
6
+{{ $ghlink := printf "https://%s/%s%s" site.Params.githubwebsiteraw (default "main" (site.Params.github_branch)) $filename | safeURL }}
7
+
8
+<a href="{{ $ghlink }}" download="{{ $file }}">
9
+{{- if gt (len .Inner) 0 -}}
10
+ {{- .Inner -}}
11
+{{- else -}}
12
+ {{- $file -}}
13
+{{- end -}}
14
+</a>
0 commit comments