Skip to content

Commit cd72d13

Browse files
committed
Add social plugin for per-page social cards with auto-generated preview images
1 parent f03fb96 commit cd72d13

7 files changed

Lines changed: 54 additions & 4 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ jobs:
1818
- uses: astral-sh/setup-uv@v7
1919
with:
2020
enable-cache: true
21+
- run: sudo apt-get install -y libcairo2
2122
- run: uv run mkdocs build
2223
- uses: peaceiris/actions-gh-pages@v4
2324
with:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ docs/blog/posts/drafts/*
33
.python-version
44
__pycache__/
55
.agents/
6+
.cache/

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
CAIRO_LIB := $(shell pkg-config --variable=libdir cairo)
2+
13
html:
2-
uv run mkdocs serve
4+
DYLD_FALLBACK_LIBRARY_PATH=$(CAIRO_LIB) uv run mkdocs serve

docs/overrides/main.html

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22

33
{% block extrahead %}
44
<meta name="google-site-verification" content="8viHBc_t5bEEtPJfuu29pd_den6Xa6tD4G9ZdCLOwl4">
5-
<meta property="og:image" content="{{ config.site_url }}images/social-banner.png">
6-
<meta property="og:image:width" content="1200">
7-
<meta property="og:image:height" content="630">
85
{% if "blog/posts/" in page.url %}
96
{% set description = page.meta.description | default(config.site_description) %}
107
<script type="application/ld+json">

mkdocs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ plugins:
3434
- search
3535
- mkdocs-video
3636
- tags
37+
- social
3738
- markdownextradata
3839
- git-revision-date-localized:
3940
enable_creation_date: true
@@ -42,6 +43,7 @@ plugins:
4243
categories:
4344
- tags
4445
comments_path: "#__comments"
46+
image: images/social-banner.png
4547
# - mkdocs-jupyter
4648

4749
markdown_extensions:

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ docs = [
2121
"mkdocs-git-revision-date-localized-plugin>=1.1.0,<2",
2222
"mkdocs-video>=1.5.0",
2323
"mkdocs-rss-plugin>=1.19.0",
24+
"cairosvg>=2.9.0",
25+
"cairocffi>=1.7.1",
2426
]
2527
misc = [
2628
"pandas>=2.0.3,<3",

uv.lock

Lines changed: 45 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)