Skip to content

Commit 634e537

Browse files
committed
feat(social): generate Open Graph / social card images
Enable Material's social plugin so every page gets an auto-generated Open Graph / Twitter card image — links shared to GitHub/Slack/X now render a rich preview instead of a bare URL. Card generation needs native imaging libs (Cairo etc.), which aren't available in every build environment (e.g. Netlify PR previews). To keep those builds working, the plugin is gated behind a CARDS env var that defaults to false; only the GitHub Pages deploy — where the libs are installed — sets CARDS=true and actually renders the cards. - mkdocs.yml: add `social` plugin with `cards: !ENV [CARDS, false]` - docs/requirements.txt: mkdocs-material -> mkdocs-material[imaging] - deploy.yml: install imaging system deps and set CARDS=true for the build
1 parent 7a7b814 commit 634e537

3 files changed

Lines changed: 14 additions & 1 deletion

File tree

.github/workflows/deploy.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,23 @@ on:
88
jobs:
99
build:
1010
runs-on: ubuntu-latest
11+
env:
12+
# Enable Material's social card generation for the deployed site.
13+
# Environments without the native imaging libs (e.g. Netlify previews)
14+
# leave this unset, so card generation is skipped there.
15+
CARDS: 'true'
1116
steps:
1217
- name: Checkout Repository
1318
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
1419
with:
1520
persist-credentials: false
1621

22+
- name: Install imaging system dependencies (for social cards)
23+
run: |
24+
sudo apt-get update
25+
sudo apt-get install -y \
26+
libcairo2-dev libfreetype6-dev libffi-dev libjpeg-dev libpng-dev libz-dev
27+
1728
- name: Set up Python
1829
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
1930
with:

docs/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
markdown-gfm-admonition
22
mkdocs
33
mkdocs-include-markdown-plugin
4-
mkdocs-material
4+
mkdocs-material[imaging]

mkdocs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ markdown_extensions:
8383

8484
plugins:
8585
- search
86+
- social:
87+
cards: !ENV [CARDS, false]
8688
- blog
8789

8890
extra_css:

0 commit comments

Comments
 (0)