hugo-theme-more-contentful/layouts/partials/components.html

33 lines
1.2 KiB
HTML
Raw Permalink Normal View History

{{- /*
Here's where all of the inline partials are defined.
If the partial is short enough, it should be put here.
*/ -}}
{{- /*
A partial that aliases the Heroicon template from the icon partial.
*/ -}}
{{- define "partials/components/heroicon.html" }}
{{- $name := default .id .name }}
{{- $res := resources.ExecuteAsTemplate (printf "icons/generic/%s.svg" .id)
(dict "id" .id
"name" $name)
(resources.Get "templates/heroicon.svg") }}
<svg class="site__icon">
<use href="{{ $res.RelPermalink }}#{{ $name }}"></use>
</svg>
{{ end }}
{{- /*
A partial for easily using icons from Simple Icons set.
*/ -}}
{{- define "partials/components/simple-icon.html" }}
{{- $name := default .id .name }}
{{- $res := resources.ExecuteAsTemplate (printf "icons/brand/%s.svg" .id)
(dict "id" .id
"name" $name)
(resources.Get "templates/simple-icon.svg") }}
<svg class="site__icon">
<use href="{{ $res.RelPermalink }}#{{ $name }}"></use>
</svg>
{{- end }}