Files
clawandfukunee 07851043b1 chore: 初始化 Hugo 博客项目
Hextra 主题,8 篇文章,支持全文搜索/暗色模式
2026-05-13 12:48:53 +08:00

29 lines
710 B
HTML

{{- /*
Create an icon.
@param {string} name The name of the icon.
@param {string} attributes The attributes of the icon.
or
@param {string} 0 The name of the icon.
@example {{< icon name="github" >}}
@example {{< icon "github" >}}
*/ -}}
{{- $name := .Get "name" | default (.Get 0) -}}
{{- $siteData := partial "utils/hugo-compat/site-data.html" . -}}
{{- $icon := index $siteData.icons $name -}}
{{- $attributes := .Get "attributes" | default "height=1em"}}
{{- if not $icon -}}
{{ errorf "icon %q not found" $name }}
{{- end -}}
{{- $icon = replaceRE "<svg" (printf "<svg %s" $attributes) $icon -}}
<span class="hx:inline-block hx:align-text-bottom hextra-icon">
{{- $icon | safeHTML -}}
</span>