diff --git a/layouts/shortcodes/example.html b/layouts/shortcodes/example.html new file mode 100644 index 0000000000..0d6eb7a370 --- /dev/null +++ b/layouts/shortcodes/example.html @@ -0,0 +1,14 @@ +{{ $file := .Get "file" }} +{{ $codelang := .Get "language" | default (path.Ext $file | strings.TrimPrefix ".") }} +{{ $fileDir := path.Split $file }} +{{ $bundlePath := path.Join .Page.File.Dir $fileDir.Dir }} +{{ $filename := printf "/content/%s/examples/%s" .Page.Lang $file | safeURL }} +{{ $ghlink := printf "https://%s/%s%s" site.Params.githubwebsiteraw (default "main" (site.Params.github_branch)) $filename | safeURL }} + + +{{- if gt (len .Inner) 0 -}} + {{- .Inner -}} +{{- else -}} + {{- $file -}} +{{- end -}} +