feat: support Simple Icons for social icons

This commit is contained in:
st1020 2024-05-19 18:22:56 +08:00
parent 01e0b32dcf
commit 968ba4178a
14 changed files with 14 additions and 24 deletions

8
templates/macros.html Normal file
View file

@ -0,0 +1,8 @@
{%- macro get_social_icon(icon) -%}
{%- set meta = get_image_metadata(path="/static/icons/" ~ icon ~ ".svg", allow_missing=true) -%}
{%- if meta -%}
{{- get_url(path="icons/" ~ icon ~ ".svg") -}}
{%- else -%}
{{- "https://cdn.jsdelivr.net/npm/simple-icons/icons/" ~ icon ~ ".svg" -}}
{%- endif -%}
{%- endmacro get_social_icon -%}