diff --git a/.prettierignore b/.prettierignore index bd5535a..ee13637 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1 +1,2 @@ pnpm-lock.yaml +templates/macros.html diff --git a/config.toml b/config.toml index 6b64ddb..1fb2065 100644 --- a/config.toml +++ b/config.toml @@ -79,6 +79,7 @@ avatar_url = "icons/github.svg" avatar_invert = true # The social icons below the profile on the home page. +# The `name` should be the file name of static/icons/*.svg or the icon name of https://simpleicons.org/ [[extra.profile.social]] name = "github" url = "https://github.com/st1020/kita" diff --git a/static/icons/codeberg.svg b/static/icons/codeberg.svg deleted file mode 100644 index f65296f..0000000 --- a/static/icons/codeberg.svg +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/static/icons/goodreads.svg b/static/icons/goodreads.svg deleted file mode 100644 index 59e80bd..0000000 --- a/static/icons/goodreads.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/static/icons/instagram.svg b/static/icons/instagram.svg deleted file mode 100644 index fb0ad37..0000000 --- a/static/icons/instagram.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/static/icons/linkedin.svg b/static/icons/linkedin.svg deleted file mode 100644 index bcdc2cb..0000000 --- a/static/icons/linkedin.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/static/icons/mastodon.svg b/static/icons/mastodon.svg deleted file mode 100644 index 729af48..0000000 --- a/static/icons/mastodon.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/static/icons/stackoverflow.svg b/static/icons/stackoverflow.svg deleted file mode 100644 index f5c1bd9..0000000 --- a/static/icons/stackoverflow.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - stackoverflow - - - \ No newline at end of file diff --git a/static/icons/telegram.svg b/static/icons/telegram.svg deleted file mode 100644 index 8536d2c..0000000 --- a/static/icons/telegram.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - -telegram - - \ No newline at end of file diff --git a/static/icons/twitter.svg b/static/icons/twitter.svg deleted file mode 100644 index 0ba5c46..0000000 --- a/static/icons/twitter.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/templates/index.html b/templates/index.html index 389c8f3..89b1617 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,3 +1,4 @@ +{% import "macros.html" as macros %} {% include "partials/head.html" %} diff --git a/templates/macros.html b/templates/macros.html new file mode 100644 index 0000000..a533d1c --- /dev/null +++ b/templates/macros.html @@ -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 -%} diff --git a/templates/partials/head.html b/templates/partials/head.html index 10117eb..73327c2 100644 --- a/templates/partials/head.html +++ b/templates/partials/head.html @@ -1,3 +1,4 @@ +{% import "macros.html" as macros %} @@ -68,7 +69,7 @@ {% if config.extra.profile.social %} {% for social in config.extra.profile.social %} - + {% endfor %} {% endif %} diff --git a/templates/partials/profile.html b/templates/partials/profile.html index 5533f94..565431e 100644 --- a/templates/partials/profile.html +++ b/templates/partials/profile.html @@ -24,7 +24,7 @@ {% for social in config.extra.profile.social %}