hugo-geekblog/layouts/shortcodes/include.html

19 lines
544 B
HTML
Raw Permalink Normal View History

2021-11-23 13:33:03 +00:00
{{ $file := .Get "file" }}
{{ $page := .Site.GetPage $file }}
{{ $type := .Get "type" }}
{{ $language := .Get "language" }}
{{ $options :=.Get "options" }}
<div class="gblog-include">
{{- if (.Get "language") -}}
2021-11-23 13:33:03 +00:00
{{- highlight ($file | readFile) $language (default "linenos=table" $options) -}}
{{- else if eq $type "html" -}}
2021-11-23 13:33:03 +00:00
{{- $file | readFile | safeHTML -}}
{{- else if eq $type "page" -}}
2021-11-23 13:33:03 +00:00
{{- with $page }}{{ .Content }}{{ end -}}
{{- else -}}
2021-11-23 13:33:03 +00:00
{{- $file | readFile | $.Page.RenderString -}}
{{- end -}}
2021-11-23 13:33:03 +00:00
</div>