fix: get_social_icon can not get local icon

This commit is contained in:
st1020 2024-08-01 21:49:55 +08:00
parent f6e399016a
commit 0b07957c59
2 changed files with 4 additions and 3 deletions

View file

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

View file

@ -88,7 +88,7 @@
{% endif %} {% endif %}
<!-- Dark Icon --> <!-- Dark Icon -->
<link rel="preload" as="image" href="{{ get_url(path=`icons/` ~ `theme.svg`) }}" /> <link rel="preload" as="image" href="{{ get_url(path=`icons/theme.svg`) }}" />
<!-- Math --> <!-- Math -->
{% if page.extra.math | default(value=config.extra.math) %} {% if page.extra.math | default(value=config.extra.math) %}