eturl.html - hugo - [fork] hugo port for 9front
HTML git clone https://git.drkhsh.at/hugo.git
DIR Log
DIR Files
DIR Refs
DIR Submodules
DIR README
DIR LICENSE
---
eturl.html (1176B)
---
1 {{/* prettier-ignore-start */ -}}
2 {{- /*
3 Renders an absolute URL to the source code for an embedded template.
4
5 Accepts either positional or named parameters, and depends on the
6 embedded_templates.toml file in the data directory.
7
8 @param {string} filename The embedded template's file name, excluding extension.
9
10 @example {{% et robots.txt %}}
11 @example {{% et filename=robots.txt %}}
12 */ -}}
13 {{/* prettier-ignore-end */ -}}
14 {{- with $filename := or (.Get "filename") (.Get 0) }}
15 {{- with site.Data.embedded_template_urls }}
16 {{- with index . $filename }}
17 {{- urls.JoinPath site.Data.embedded_template_urls.base_url . }}
18 {{- else }}
19 {{- errorf "The %q shortcode was unable to find a URL for the embedded template named %q. Check the name. See %s" $.Name $filename $.Position }}
20 {{- end }}
21 {{- else }}
22 {{- errorf "The %q shortcode was unable to find the embedded_template_urls data file in the site's data directory. See %s" $.Name $.Position }}
23 {{- end }}
24 {{- else }}
25 {{- errorf "The %q shortcodes requires a named or positional parameter, the file name of the embedded template, excluding its extension. See %s" .Name .Position }}
26 {{- end -}}