File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -103,6 +103,8 @@ jobs:
103103
104104 - name : Generate social cards for blog posts
105105 run : |
106+ sudo apt-get update
107+ sudo apt-get install -y librsvg2-bin
106108 chmod +x scripts/generate-social-cards.sh
107109 ./scripts/generate-social-cards.sh
108110
Original file line number Diff line number Diff line change 77
88 {% seo %}
99
10- {% assign social_card_path = "/social-cards/" | append: page.slug | append: ".svg " %}
10+ {% assign social_card_path = "/social-cards/" | append: page.slug | append: ".png " %}
1111
12- <!-- Open Graph / Facebook -->
12+ <!-- Open Graph / Facebook / LinkedIn -->
1313 < meta property ="og:type " content ="article ">
1414 < meta property ="og:url " content ="{{ page.url | absolute_url }} ">
1515 < meta property ="og:title " content ="{{ page.title | escape }} ">
1616 < meta property ="og:description " content ="{{ page.excerpt | default: page.content | strip_html | truncate: 200 | escape }} ">
1717 < meta property ="og:image " content ="{{ social_card_path | absolute_url }} ">
18+ < meta property ="og:image:type " content ="image/png ">
1819 < meta property ="og:image:width " content ="1200 ">
1920 < meta property ="og:image:height " content ="630 ">
2021 < meta property ="og:site_name " content ="{{ site.title }} ">
Original file line number Diff line number Diff line change @@ -105,11 +105,20 @@ for post_file in "$POSTS_DIR"/*.md; do
105105 title_escaped=$( echo " $title " | sed ' s/&/\&/g; s/</\</g; s/>/\>/g; s/"/\"/g' )
106106
107107 # Generate SVG
108- output_file =" $SOCIAL_CARDS_DIR /${slug} .svg"
109- read_template | sed " s/TITLE_PLACEHOLDER/$title_escaped /g" | sed " s/DATE_PLACEHOLDER/$formatted_date /g" > " $output_file "
108+ output_svg =" $SOCIAL_CARDS_DIR /${slug} .svg"
109+ read_template | sed " s/TITLE_PLACEHOLDER/$title_escaped /g" | sed " s/DATE_PLACEHOLDER/$formatted_date /g" > " $output_svg "
110110
111- echo " Generated: $output_file "
111+ echo " Generated: $output_svg "
112+
113+ # Convert SVG to PNG using rsvg-convert (if available)
114+ output_png=" $SOCIAL_CARDS_DIR /${slug} .png"
115+ if command -v rsvg-convert & > /dev/null; then
116+ rsvg-convert -w 1200 -h 630 " $output_svg " -o " $output_png "
117+ echo " Generated: $output_png "
118+ else
119+ echo " Warning: rsvg-convert not found, skipping PNG generation for $slug "
120+ fi
112121 fi
113122done
114123
115- echo " Social card generation complete!"
124+ echo " Social card generation complete!"
You can’t perform that action at this time.
0 commit comments