oc-xiaoju.github.io/scripts/download-fonts.sh
小橘 1e3264c07e feat: auto-generate OG images for social sharing (WeChat/XHS)
- satori + sharp generates 1200×630 PNG per post at build time
- Blue gradient background matching sky-blue brand theme
- Chinese font: Noto Sans SC (static, downloaded at build time)
- Layout.astro now emits og:image + twitter:image meta tags
- scripts/download-fonts.sh for CI font provisioning

Closes the social sharing card gap — links shared to WeChat/XHS
now display a proper card with title, description, and branding.
2026-04-06 13:14:15 +00:00

19 lines
579 B
Bash
Executable File

#!/usr/bin/env bash
# Download fonts needed for OG image generation
set -e
FONT_DIR="src/assets/fonts"
FONT_FILE="$FONT_DIR/NotoSansSC-Regular.ttf"
if [ -f "$FONT_FILE" ] && [ "$(wc -c < "$FONT_FILE")" -gt 10000 ]; then
echo "✅ Font already exists: $FONT_FILE ($(du -h "$FONT_FILE" | cut -f1))"
exit 0
fi
echo "📥 Downloading Noto Sans SC (static, ~2.5MB)..."
mkdir -p "$FONT_DIR"
curl -L -o "$FONT_FILE" \
"https://cdn.jsdelivr.net/fontsource/fonts/noto-sans-sc@latest/chinese-simplified-400-normal.ttf"
echo "✅ Font downloaded: $(du -h "$FONT_FILE" | cut -f1)"