From 3c61e89adbb0ae3ed870ebfc3402caae9e73b43a Mon Sep 17 00:00:00 2001 From: tiennm99 Date: Fri, 1 May 2026 14:16:05 +0700 Subject: [PATCH] feat(icons): vendor Lucide UI + Simple Icons brand sets, data-driven partial MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add scripts/sync-icons.sh to fetch 25 brand (Simple Icons v13) + 10 UI (Lucide v0.460) SVGs; idempotent, pinned versions, currentColor-normalised - Vendor SVGs into assets/icons/{brand,ui}/ - Add data/icons.yaml manifest mapping public names → {family, slug} - Rewrite layouts/partials/icon.html (13 lines) to data-driven resources.Get with generic external-link fallback for unknown names - Add layouts/icons/single.html gallery page; exampleSite demo link - Add NOTICE crediting Simple Icons (CC0 1.0) and Lucide (ISC) - Update README with available-icons
section - Add mastodon + bsky demo links to exampleSite/hugo.toml --- themes/bonsai/NOTICE | 22 +++++ themes/bonsai/README.md | 57 ++++++++++++ themes/bonsai/assets/icons/brand/bluesky.svg | 1 + .../assets/icons/brand/buymeacoffee.svg | 1 + themes/bonsai/assets/icons/brand/devdotto.svg | 1 + themes/bonsai/assets/icons/brand/discord.svg | 1 + themes/bonsai/assets/icons/brand/facebook.svg | 1 + themes/bonsai/assets/icons/brand/github.svg | 1 + themes/bonsai/assets/icons/brand/gitlab.svg | 1 + themes/bonsai/assets/icons/brand/hashnode.svg | 1 + .../bonsai/assets/icons/brand/instagram.svg | 1 + themes/bonsai/assets/icons/brand/kofi.svg | 1 + themes/bonsai/assets/icons/brand/linkedin.svg | 1 + themes/bonsai/assets/icons/brand/mastodon.svg | 1 + themes/bonsai/assets/icons/brand/medium.svg | 1 + themes/bonsai/assets/icons/brand/patreon.svg | 1 + themes/bonsai/assets/icons/brand/paypal.svg | 1 + themes/bonsai/assets/icons/brand/reddit.svg | 1 + themes/bonsai/assets/icons/brand/signal.svg | 1 + themes/bonsai/assets/icons/brand/substack.svg | 1 + themes/bonsai/assets/icons/brand/telegram.svg | 1 + themes/bonsai/assets/icons/brand/threads.svg | 1 + themes/bonsai/assets/icons/brand/tiktok.svg | 1 + themes/bonsai/assets/icons/brand/twitch.svg | 1 + themes/bonsai/assets/icons/brand/whatsapp.svg | 1 + themes/bonsai/assets/icons/brand/x.svg | 1 + themes/bonsai/assets/icons/brand/youtube.svg | 1 + themes/bonsai/assets/icons/ui/calendar.svg | 17 ++++ .../bonsai/assets/icons/ui/external-link.svg | 16 ++++ themes/bonsai/assets/icons/ui/file-text.svg | 18 ++++ themes/bonsai/assets/icons/ui/globe.svg | 16 ++++ themes/bonsai/assets/icons/ui/link.svg | 15 +++ themes/bonsai/assets/icons/ui/mail.svg | 15 +++ themes/bonsai/assets/icons/ui/map-pin.svg | 15 +++ themes/bonsai/assets/icons/ui/phone.svg | 14 +++ themes/bonsai/assets/icons/ui/rss.svg | 16 ++++ themes/bonsai/assets/icons/ui/share-2.svg | 18 ++++ themes/bonsai/data/icons.yaml | 44 +++++++++ .../bonsai/exampleSite/content/icons/index.md | 6 ++ themes/bonsai/exampleSite/hugo.toml | 10 ++ themes/bonsai/layouts/icons/single.html | 14 +++ themes/bonsai/layouts/partials/icon.html | 28 ++---- themes/bonsai/scripts/sync-icons.sh | 93 +++++++++++++++++++ themes/bonsai/theme.toml | 2 +- 44 files changed, 442 insertions(+), 19 deletions(-) create mode 100644 themes/bonsai/NOTICE create mode 100644 themes/bonsai/assets/icons/brand/bluesky.svg create mode 100644 themes/bonsai/assets/icons/brand/buymeacoffee.svg create mode 100644 themes/bonsai/assets/icons/brand/devdotto.svg create mode 100644 themes/bonsai/assets/icons/brand/discord.svg create mode 100644 themes/bonsai/assets/icons/brand/facebook.svg create mode 100644 themes/bonsai/assets/icons/brand/github.svg create mode 100644 themes/bonsai/assets/icons/brand/gitlab.svg create mode 100644 themes/bonsai/assets/icons/brand/hashnode.svg create mode 100644 themes/bonsai/assets/icons/brand/instagram.svg create mode 100644 themes/bonsai/assets/icons/brand/kofi.svg create mode 100644 themes/bonsai/assets/icons/brand/linkedin.svg create mode 100644 themes/bonsai/assets/icons/brand/mastodon.svg create mode 100644 themes/bonsai/assets/icons/brand/medium.svg create mode 100644 themes/bonsai/assets/icons/brand/patreon.svg create mode 100644 themes/bonsai/assets/icons/brand/paypal.svg create mode 100644 themes/bonsai/assets/icons/brand/reddit.svg create mode 100644 themes/bonsai/assets/icons/brand/signal.svg create mode 100644 themes/bonsai/assets/icons/brand/substack.svg create mode 100644 themes/bonsai/assets/icons/brand/telegram.svg create mode 100644 themes/bonsai/assets/icons/brand/threads.svg create mode 100644 themes/bonsai/assets/icons/brand/tiktok.svg create mode 100644 themes/bonsai/assets/icons/brand/twitch.svg create mode 100644 themes/bonsai/assets/icons/brand/whatsapp.svg create mode 100644 themes/bonsai/assets/icons/brand/x.svg create mode 100644 themes/bonsai/assets/icons/brand/youtube.svg create mode 100644 themes/bonsai/assets/icons/ui/calendar.svg create mode 100644 themes/bonsai/assets/icons/ui/external-link.svg create mode 100644 themes/bonsai/assets/icons/ui/file-text.svg create mode 100644 themes/bonsai/assets/icons/ui/globe.svg create mode 100644 themes/bonsai/assets/icons/ui/link.svg create mode 100644 themes/bonsai/assets/icons/ui/mail.svg create mode 100644 themes/bonsai/assets/icons/ui/map-pin.svg create mode 100644 themes/bonsai/assets/icons/ui/phone.svg create mode 100644 themes/bonsai/assets/icons/ui/rss.svg create mode 100644 themes/bonsai/assets/icons/ui/share-2.svg create mode 100644 themes/bonsai/data/icons.yaml create mode 100644 themes/bonsai/exampleSite/content/icons/index.md create mode 100644 themes/bonsai/layouts/icons/single.html create mode 100755 themes/bonsai/scripts/sync-icons.sh diff --git a/themes/bonsai/NOTICE b/themes/bonsai/NOTICE new file mode 100644 index 0000000..3792b7d --- /dev/null +++ b/themes/bonsai/NOTICE @@ -0,0 +1,22 @@ +Bonsai Hugo Theme — Third-Party Notices +======================================== + +This theme vendors SVG icons from two open-source projects: + +1. Simple Icons (brand icons) + Source: https://simpleicons.org / https://github.com/simple-icons/simple-icons + Version: 13.0.0 + License: CC0 1.0 Universal (Public Domain Dedication) + https://creativecommons.org/publicdomain/zero/1.0/ + Files: assets/icons/brand/*.svg + +2. Lucide (UI icons) + Source: https://lucide.dev / https://github.com/lucide-icons/lucide + Version: 0.460.0 (lucide-static) + License: ISC License + Copyright (c) 2020, Lucide Contributors + Permission to use, copy, modify, and/or distribute this software + for any purpose with or without fee is hereby granted, provided + that the above copyright notice and this permission notice appear + in all copies. + Files: assets/icons/ui/*.svg diff --git a/themes/bonsai/README.md b/themes/bonsai/README.md index 05f53cd..6d98a1c 100644 --- a/themes/bonsai/README.md +++ b/themes/bonsai/README.md @@ -79,6 +79,63 @@ theme = "bonsai" See `exampleSite/` for a full reference. +## Available Icons + +
+Brand / Social (25) + +| Name | Source | +|------|--------| +| `github` | Simple Icons | +| `gitlab` | Simple Icons | +| `mastodon` | Simple Icons | +| `bsky` | Simple Icons | +| `x` | Simple Icons | +| `threads` | Simple Icons | +| `linkedin` | Simple Icons | +| `instagram` | Simple Icons | +| `facebook` | Simple Icons | +| `tiktok` | Simple Icons | +| `youtube` | Simple Icons | +| `twitch` | Simple Icons | +| `discord` | Simple Icons | +| `telegram` | Simple Icons | +| `signal` | Simple Icons | +| `whatsapp` | Simple Icons | +| `reddit` | Simple Icons | +| `medium` | Simple Icons | +| `devto` | Simple Icons | +| `substack` | Simple Icons | +| `hashnode` | Simple Icons | +| `kofi` | Simple Icons | +| `patreon` | Simple Icons | +| `buymeacoffee` | Simple Icons | +| `paypal` | Simple Icons | + +
+ +
+UI / Utility (10) + +| Name | Source | +|------|--------| +| `mail` | Lucide | +| `globe` | Lucide | +| `link` | Lucide | +| `rss` | Lucide | +| `calendar` | Lucide | +| `phone` | Lucide | +| `mappin` | Lucide | +| `filetext` | Lucide | +| `extlink` | Lucide | +| `share` | Lucide | + +
+ +Icons are vendored at build time — no CDN fetch at runtime. To refresh or add icons, edit `scripts/sync-icons.sh` and `data/icons.yaml`, then re-run the script. + +See `exampleSite/content/icons/` for a rendered gallery (run locally). + ## Development ```bash diff --git a/themes/bonsai/assets/icons/brand/bluesky.svg b/themes/bonsai/assets/icons/brand/bluesky.svg new file mode 100644 index 0000000..e332981 --- /dev/null +++ b/themes/bonsai/assets/icons/brand/bluesky.svg @@ -0,0 +1 @@ +Bluesky diff --git a/themes/bonsai/assets/icons/brand/buymeacoffee.svg b/themes/bonsai/assets/icons/brand/buymeacoffee.svg new file mode 100644 index 0000000..fee51ef --- /dev/null +++ b/themes/bonsai/assets/icons/brand/buymeacoffee.svg @@ -0,0 +1 @@ +Buy Me A Coffee diff --git a/themes/bonsai/assets/icons/brand/devdotto.svg b/themes/bonsai/assets/icons/brand/devdotto.svg new file mode 100644 index 0000000..863e6ca --- /dev/null +++ b/themes/bonsai/assets/icons/brand/devdotto.svg @@ -0,0 +1 @@ +dev.to diff --git a/themes/bonsai/assets/icons/brand/discord.svg b/themes/bonsai/assets/icons/brand/discord.svg new file mode 100644 index 0000000..9b77fc9 --- /dev/null +++ b/themes/bonsai/assets/icons/brand/discord.svg @@ -0,0 +1 @@ +Discord diff --git a/themes/bonsai/assets/icons/brand/facebook.svg b/themes/bonsai/assets/icons/brand/facebook.svg new file mode 100644 index 0000000..154efc1 --- /dev/null +++ b/themes/bonsai/assets/icons/brand/facebook.svg @@ -0,0 +1 @@ +Facebook diff --git a/themes/bonsai/assets/icons/brand/github.svg b/themes/bonsai/assets/icons/brand/github.svg new file mode 100644 index 0000000..2334976 --- /dev/null +++ b/themes/bonsai/assets/icons/brand/github.svg @@ -0,0 +1 @@ +GitHub diff --git a/themes/bonsai/assets/icons/brand/gitlab.svg b/themes/bonsai/assets/icons/brand/gitlab.svg new file mode 100644 index 0000000..ab1286a --- /dev/null +++ b/themes/bonsai/assets/icons/brand/gitlab.svg @@ -0,0 +1 @@ +GitLab diff --git a/themes/bonsai/assets/icons/brand/hashnode.svg b/themes/bonsai/assets/icons/brand/hashnode.svg new file mode 100644 index 0000000..140b177 --- /dev/null +++ b/themes/bonsai/assets/icons/brand/hashnode.svg @@ -0,0 +1 @@ +Hashnode diff --git a/themes/bonsai/assets/icons/brand/instagram.svg b/themes/bonsai/assets/icons/brand/instagram.svg new file mode 100644 index 0000000..315cbee --- /dev/null +++ b/themes/bonsai/assets/icons/brand/instagram.svg @@ -0,0 +1 @@ +Instagram diff --git a/themes/bonsai/assets/icons/brand/kofi.svg b/themes/bonsai/assets/icons/brand/kofi.svg new file mode 100644 index 0000000..b5c3ef6 --- /dev/null +++ b/themes/bonsai/assets/icons/brand/kofi.svg @@ -0,0 +1 @@ +Ko-fi diff --git a/themes/bonsai/assets/icons/brand/linkedin.svg b/themes/bonsai/assets/icons/brand/linkedin.svg new file mode 100644 index 0000000..181773d --- /dev/null +++ b/themes/bonsai/assets/icons/brand/linkedin.svg @@ -0,0 +1 @@ +LinkedIn diff --git a/themes/bonsai/assets/icons/brand/mastodon.svg b/themes/bonsai/assets/icons/brand/mastodon.svg new file mode 100644 index 0000000..d059845 --- /dev/null +++ b/themes/bonsai/assets/icons/brand/mastodon.svg @@ -0,0 +1 @@ +Mastodon diff --git a/themes/bonsai/assets/icons/brand/medium.svg b/themes/bonsai/assets/icons/brand/medium.svg new file mode 100644 index 0000000..642fd0d --- /dev/null +++ b/themes/bonsai/assets/icons/brand/medium.svg @@ -0,0 +1 @@ +Medium diff --git a/themes/bonsai/assets/icons/brand/patreon.svg b/themes/bonsai/assets/icons/brand/patreon.svg new file mode 100644 index 0000000..c29b78d --- /dev/null +++ b/themes/bonsai/assets/icons/brand/patreon.svg @@ -0,0 +1 @@ +Patreon diff --git a/themes/bonsai/assets/icons/brand/paypal.svg b/themes/bonsai/assets/icons/brand/paypal.svg new file mode 100644 index 0000000..ad083ad --- /dev/null +++ b/themes/bonsai/assets/icons/brand/paypal.svg @@ -0,0 +1 @@ +PayPal diff --git a/themes/bonsai/assets/icons/brand/reddit.svg b/themes/bonsai/assets/icons/brand/reddit.svg new file mode 100644 index 0000000..0a9850f --- /dev/null +++ b/themes/bonsai/assets/icons/brand/reddit.svg @@ -0,0 +1 @@ +Reddit diff --git a/themes/bonsai/assets/icons/brand/signal.svg b/themes/bonsai/assets/icons/brand/signal.svg new file mode 100644 index 0000000..d7c97b9 --- /dev/null +++ b/themes/bonsai/assets/icons/brand/signal.svg @@ -0,0 +1 @@ +Signal diff --git a/themes/bonsai/assets/icons/brand/substack.svg b/themes/bonsai/assets/icons/brand/substack.svg new file mode 100644 index 0000000..7374831 --- /dev/null +++ b/themes/bonsai/assets/icons/brand/substack.svg @@ -0,0 +1 @@ +Substack diff --git a/themes/bonsai/assets/icons/brand/telegram.svg b/themes/bonsai/assets/icons/brand/telegram.svg new file mode 100644 index 0000000..44f6951 --- /dev/null +++ b/themes/bonsai/assets/icons/brand/telegram.svg @@ -0,0 +1 @@ +Telegram diff --git a/themes/bonsai/assets/icons/brand/threads.svg b/themes/bonsai/assets/icons/brand/threads.svg new file mode 100644 index 0000000..68cf664 --- /dev/null +++ b/themes/bonsai/assets/icons/brand/threads.svg @@ -0,0 +1 @@ +Threads diff --git a/themes/bonsai/assets/icons/brand/tiktok.svg b/themes/bonsai/assets/icons/brand/tiktok.svg new file mode 100644 index 0000000..6d8c01e --- /dev/null +++ b/themes/bonsai/assets/icons/brand/tiktok.svg @@ -0,0 +1 @@ +TikTok diff --git a/themes/bonsai/assets/icons/brand/twitch.svg b/themes/bonsai/assets/icons/brand/twitch.svg new file mode 100644 index 0000000..8cb2b81 --- /dev/null +++ b/themes/bonsai/assets/icons/brand/twitch.svg @@ -0,0 +1 @@ +Twitch diff --git a/themes/bonsai/assets/icons/brand/whatsapp.svg b/themes/bonsai/assets/icons/brand/whatsapp.svg new file mode 100644 index 0000000..10b8462 --- /dev/null +++ b/themes/bonsai/assets/icons/brand/whatsapp.svg @@ -0,0 +1 @@ +WhatsApp diff --git a/themes/bonsai/assets/icons/brand/x.svg b/themes/bonsai/assets/icons/brand/x.svg new file mode 100644 index 0000000..5f40ec3 --- /dev/null +++ b/themes/bonsai/assets/icons/brand/x.svg @@ -0,0 +1 @@ +X diff --git a/themes/bonsai/assets/icons/brand/youtube.svg b/themes/bonsai/assets/icons/brand/youtube.svg new file mode 100644 index 0000000..4ed25db --- /dev/null +++ b/themes/bonsai/assets/icons/brand/youtube.svg @@ -0,0 +1 @@ +YouTube diff --git a/themes/bonsai/assets/icons/ui/calendar.svg b/themes/bonsai/assets/icons/ui/calendar.svg new file mode 100644 index 0000000..63fd3c0 --- /dev/null +++ b/themes/bonsai/assets/icons/ui/calendar.svg @@ -0,0 +1,17 @@ + + + + + + diff --git a/themes/bonsai/assets/icons/ui/external-link.svg b/themes/bonsai/assets/icons/ui/external-link.svg new file mode 100644 index 0000000..a1e6bdc --- /dev/null +++ b/themes/bonsai/assets/icons/ui/external-link.svg @@ -0,0 +1,16 @@ + + + + + diff --git a/themes/bonsai/assets/icons/ui/file-text.svg b/themes/bonsai/assets/icons/ui/file-text.svg new file mode 100644 index 0000000..241b9cd --- /dev/null +++ b/themes/bonsai/assets/icons/ui/file-text.svg @@ -0,0 +1,18 @@ + + + + + + + diff --git a/themes/bonsai/assets/icons/ui/globe.svg b/themes/bonsai/assets/icons/ui/globe.svg new file mode 100644 index 0000000..d7a3126 --- /dev/null +++ b/themes/bonsai/assets/icons/ui/globe.svg @@ -0,0 +1,16 @@ + + + + + diff --git a/themes/bonsai/assets/icons/ui/link.svg b/themes/bonsai/assets/icons/ui/link.svg new file mode 100644 index 0000000..58d552d --- /dev/null +++ b/themes/bonsai/assets/icons/ui/link.svg @@ -0,0 +1,15 @@ + + + + diff --git a/themes/bonsai/assets/icons/ui/mail.svg b/themes/bonsai/assets/icons/ui/mail.svg new file mode 100644 index 0000000..bdaa627 --- /dev/null +++ b/themes/bonsai/assets/icons/ui/mail.svg @@ -0,0 +1,15 @@ + + + + diff --git a/themes/bonsai/assets/icons/ui/map-pin.svg b/themes/bonsai/assets/icons/ui/map-pin.svg new file mode 100644 index 0000000..6d85c4d --- /dev/null +++ b/themes/bonsai/assets/icons/ui/map-pin.svg @@ -0,0 +1,15 @@ + + + + diff --git a/themes/bonsai/assets/icons/ui/phone.svg b/themes/bonsai/assets/icons/ui/phone.svg new file mode 100644 index 0000000..45d32a8 --- /dev/null +++ b/themes/bonsai/assets/icons/ui/phone.svg @@ -0,0 +1,14 @@ + + + diff --git a/themes/bonsai/assets/icons/ui/rss.svg b/themes/bonsai/assets/icons/ui/rss.svg new file mode 100644 index 0000000..8500dfd --- /dev/null +++ b/themes/bonsai/assets/icons/ui/rss.svg @@ -0,0 +1,16 @@ + + + + + diff --git a/themes/bonsai/assets/icons/ui/share-2.svg b/themes/bonsai/assets/icons/ui/share-2.svg new file mode 100644 index 0000000..285587e --- /dev/null +++ b/themes/bonsai/assets/icons/ui/share-2.svg @@ -0,0 +1,18 @@ + + + + + + + diff --git a/themes/bonsai/data/icons.yaml b/themes/bonsai/data/icons.yaml new file mode 100644 index 0000000..762e89f --- /dev/null +++ b/themes/bonsai/data/icons.yaml @@ -0,0 +1,44 @@ +# Icon manifest — maps public icon name → {family, slug} +# family: brand → assets/icons/brand/.svg (Simple Icons v13, CC0 1.0) +# family: ui → assets/icons/ui/.svg (Lucide Static v0.460, ISC) +# +# To add an icon: run scripts/sync-icons.sh then add an entry here. + +# --- Brand / Social --- +github: { family: brand, slug: github } +gitlab: { family: brand, slug: gitlab } +mastodon: { family: brand, slug: mastodon } +bsky: { family: brand, slug: bluesky } +x: { family: brand, slug: x } +threads: { family: brand, slug: threads } +linkedin: { family: brand, slug: linkedin } +instagram: { family: brand, slug: instagram } +facebook: { family: brand, slug: facebook } +tiktok: { family: brand, slug: tiktok } +youtube: { family: brand, slug: youtube } +twitch: { family: brand, slug: twitch } +discord: { family: brand, slug: discord } +telegram: { family: brand, slug: telegram } +signal: { family: brand, slug: signal } +whatsapp: { family: brand, slug: whatsapp } +reddit: { family: brand, slug: reddit } +medium: { family: brand, slug: medium } +devto: { family: brand, slug: devdotto } +substack: { family: brand, slug: substack } +hashnode: { family: brand, slug: hashnode } +kofi: { family: brand, slug: kofi } +patreon: { family: brand, slug: patreon } +buymeacoffee: { family: brand, slug: buymeacoffee } +paypal: { family: brand, slug: paypal } + +# --- UI / Utility --- +mail: { family: ui, slug: mail } +globe: { family: ui, slug: globe } +link: { family: ui, slug: link } +rss: { family: ui, slug: rss } +calendar: { family: ui, slug: calendar } +phone: { family: ui, slug: phone } +mappin: { family: ui, slug: map-pin } +filetext: { family: ui, slug: file-text } +extlink: { family: ui, slug: external-link } +share: { family: ui, slug: share-2 } diff --git a/themes/bonsai/exampleSite/content/icons/index.md b/themes/bonsai/exampleSite/content/icons/index.md new file mode 100644 index 0000000..ecf3c1e --- /dev/null +++ b/themes/bonsai/exampleSite/content/icons/index.md @@ -0,0 +1,6 @@ +--- +title: "Icon Gallery" +description: "All available icons in the Bonsai theme." +layout: "single" +type: "icons" +--- diff --git a/themes/bonsai/exampleSite/hugo.toml b/themes/bonsai/exampleSite/hugo.toml index 83a4335..9350ea2 100644 --- a/themes/bonsai/exampleSite/hugo.toml +++ b/themes/bonsai/exampleSite/hugo.toml @@ -33,3 +33,13 @@ disableKinds = ["taxonomy", "term", "RSS", "sitemap", "404"] title = "Email me" url = "mailto:tiennm99@outlook.com" icon = "mail" + + [[params.links]] + title = "Mastodon" + url = "https://mastodon.social/@tiennm99" + icon = "mastodon" + + [[params.links]] + title = "Bluesky" + url = "https://bsky.app/profile/tiennm99.bsky.social" + icon = "bsky" diff --git a/themes/bonsai/layouts/icons/single.html b/themes/bonsai/layouts/icons/single.html new file mode 100644 index 0000000..125044c --- /dev/null +++ b/themes/bonsai/layouts/icons/single.html @@ -0,0 +1,14 @@ +{{ define "main" }} + +{{ end }} diff --git a/themes/bonsai/layouts/partials/icon.html b/themes/bonsai/layouts/partials/icon.html index 621c3da..65be3ed 100644 --- a/themes/bonsai/layouts/partials/icon.html +++ b/themes/bonsai/layouts/partials/icon.html @@ -1,21 +1,13 @@ {{- $name := . -}} -{{- /* Minimal inline SVG icon set. Stroke uses currentColor so it picks up text color. */ -}} -{{- if eq $name "github" -}} - -{{- else if eq $name "globe" -}} - -{{- else if eq $name "mail" -}} - -{{- else if eq $name "twitter" -}} - -{{- else if eq $name "linkedin" -}} - -{{- else if eq $name "youtube" -}} - -{{- else if eq $name "instagram" -}} - -{{- else if eq $name "rss" -}} - +{{- $entry := index site.Data.icons $name -}} +{{- if $entry -}} + {{- $path := printf "icons/%s/%s.svg" $entry.family $entry.slug -}} + {{- with resources.Get $path -}} + {{- .Content | safeHTML -}} + {{- else -}} + {{- /* asset missing — fall through to fallback below */ -}} + {{- end -}} {{- else -}} - + {{- /* Unknown icon name: render generic external-link icon */ -}} + {{- end -}} diff --git a/themes/bonsai/scripts/sync-icons.sh b/themes/bonsai/scripts/sync-icons.sh new file mode 100755 index 0000000..c4b8514 --- /dev/null +++ b/themes/bonsai/scripts/sync-icons.sh @@ -0,0 +1,93 @@ +#!/usr/bin/env bash +# sync-icons.sh — vendor Simple Icons (brand) + Lucide (ui) SVGs into assets/icons/ +# Idempotent: safe to re-run; existing files are overwritten. +# +# Sources (pinned): +# Simple Icons v13.0.0 — CC0 1.0 Universal +# Lucide Static v0.460.0 — ISC License +# +# Usage: bash scripts/sync-icons.sh +# Run from repo root. + +set -euo pipefail + +SI_VERSION="13.0.0" +LUCIDE_VERSION="0.460.0" + +SI_BASE="https://cdn.jsdelivr.net/npm/simple-icons@${SI_VERSION}/icons" +LUCIDE_BASE="https://cdn.jsdelivr.net/npm/lucide-static@${LUCIDE_VERSION}/icons" + +BRAND_DIR="assets/icons/brand" +UI_DIR="assets/icons/ui" + +mkdir -p "${BRAND_DIR}" "${UI_DIR}" + +# --------------------------------------------------------------------------- +# Simple Icons brand set (~25 icons) +# Simple Icons use fill="..." with the brand color; we strip it so the icon +# inherits currentColor from its CSS context. +# --------------------------------------------------------------------------- +BRAND_ICONS=( + github gitlab mastodon bluesky x threads linkedin instagram facebook + tiktok youtube twitch discord telegram signal whatsapp reddit medium + devdotto substack hashnode kofi patreon buymeacoffee paypal +) + +fetch_brand() { + local slug="$1" + local dest="${BRAND_DIR}/${slug}.svg" + local url="${SI_BASE}/${slug}.svg" + local tmp + + tmp="$(curl -fsSL "${url}")" || { echo " WARN: failed to fetch ${url}" >&2; return; } + + # Strip hardcoded fill attribute from tag and any elements. + # Simple Icons SVGs have fill="#XXXXXX" on the root . + # Replace with fill="currentColor". + echo "${tmp}" \ + | sed 's/fill="#[0-9A-Fa-f]\{3,6\}"/fill="currentColor"/g' \ + | sed "s/fill='#[0-9A-Fa-f]\{3,6\}'/fill=\"currentColor\"/g" \ + > "${dest}" + + echo " brand/${slug}.svg" +} + +echo "Fetching Simple Icons v${SI_VERSION}..." +for slug in "${BRAND_ICONS[@]}"; do + fetch_brand "${slug}" +done + +# --------------------------------------------------------------------------- +# Lucide UI icon set (~10 icons) +# Lucide SVGs already use stroke="currentColor"; we add width/height="20" +# to normalise size and remove the class attribute (not needed for inline use). +# --------------------------------------------------------------------------- +UI_ICONS=( + mail globe link rss calendar phone map-pin file-text external-link share-2 +) + +fetch_ui() { + local slug="$1" + local dest="${UI_DIR}/${slug}.svg" + local url="${LUCIDE_BASE}/${slug}.svg" + local tmp + + tmp="$(curl -fsSL "${url}")" || { echo " WARN: failed to fetch ${url}" >&2; return; } + + # Normalise: set width/height to 20, remove class attribute, remove comment line. + echo "${tmp}" \ + | grep -v '^