uci-shortcodes/layouts/shortcodes/mdf.html

17 lines
587 B
HTML
Raw Normal View History

{{ $s := newScratch }}
{{ $s.Set "file" (.Get 0) }}
{{ if not ( path.Ext ($s.Get "file")) }}
{{ $s.Set "file" (print ($s.Get "file") ".md") }}
{{ end }}
{{ if not ( fileExists ($s.Get "file")) }}
{{ $s.Set "file" (print ( .Site.Params.extraContentDir | default "content_common") "/" ($s.Get "file")) }}
{{ end }}
<!-- file: {{ ($s.Get "file") }} -->
<div class="markdown-include">
{{ if fileExists ($s.Get "file") }}
{{ ($s.Get "file") | readFile | replaceRE "^---[\\s\\S]+?---" "" | markdownify }}
{{ else }}
Error file: {{ ($s.Get "file") }} not found
{{ end }}
</div>