forked from open-telemetry/opentelemetry.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinclude.html
24 lines (22 loc) · 796 Bytes
/
include.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
{{/* Use to include Markdown snippets. Note that the included content can have
calls to shortcodes. */ -}}
{{ $path := .Get (cond .IsNamedParams "file" 0) -}}
{{ $args := .Params -}}
{{ $page := partial "func/find-include.html" (dict "path" $path "page" .Page) -}}
{{ with $page -}}
{{ $content := .RenderShortcodes -}}
{{ range $k, $v := $args -}}
{{ $regex := printf "\\{\\{\\s*\\$%s\\s*\\}\\}" (string $k) -}}
{{ $content = replaceRE $regex $v $content -}}
{{ end -}}
{{ $content -}}
{{ else -}}
{{ $msg := printf
"Can't include '%s': file not found in page or ancestor contexts of page %s."
$path .Page.Path -}}
{{ warnf $msg -}}
<div class="alert alert-warning">
<div class="h4 alert-heading">INTERNAL SITE ERROR</div>
{{ $msg }}
</div>
{{ end -}}