Skip to content

Commit a6e194e

Browse files
committed
bump zensical to 0.0.67
Zensical now implements the social plugin natively, so the social cards that had been kept inert come back. The default card layout aborted the build twice: - set the card colors explicitly; the custom palette scheme has no primary color, which the default layout needs - drop the unused icon.logo, which named an icon that does not exist check_zensical_output.py now requires an og:image on every content page and checks that each referenced card exists.
1 parent bad86de commit a6e194e

4 files changed

Lines changed: 71 additions & 24 deletions

File tree

‎mkdocs.yml‎

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@ theme:
161161
# Necessary for search to work properly
162162

163163
icon:
164-
logo: logo
165164
tag:
166165
# https://squidfunk.github.io/mkdocs-material/reference/?h=page+icon#setting-the-page-icon
167166
video: material/video-outline
@@ -328,13 +327,20 @@ plugins:
328327
release-notes/corporate-memory-25-3/index.md: release-notes/2025/corporate-memory-25-3/index.md
329328
release-notes/corporate-memory-26-1/index.md: release-notes/2026/corporate-memory-26-1/index.md
330329
release-notes/corporate-memory-26-2/index.md: release-notes/2026/corporate-memory-26-2/index.md
331-
# The two plugins below are inert under Zensical: it neither implements nor
332-
# reports them, so social cards and revision dates are missing from the
333-
# output. They are kept so the features return automatically once Zensical
334-
# maps them. tools/check_zensical_output.py tracks both.
335-
# https://squidfunk.github.io/mkdocs-material/setup/setting-up-social-cards/
330+
# Natively implemented since Zensical 0.0.67. The colors are required: the
331+
# default card layout reads `theme.palette.primary`, which the custom scheme
332+
# leaves unset, and the build aborts on it. #0a66a3 is --md-primary-fg-color
333+
# in docs/assets/extra.css. The font defaults to Roboto, the site font.
334+
# https://zensical.org/docs/setup/social-cards/
336335
- social:
337336
cards: true
337+
cards_layout_options:
338+
background_color: "#0a66a3"
339+
color: "#ffffff"
340+
# Inert under Zensical: it neither implements nor reports the plugin, so
341+
# revision dates are missing from the output. It is kept so the feature
342+
# returns automatically once Zensical maps it.
343+
# tools/check_zensical_output.py tracks it.
338344
# https://github.com/timvink/mkdocs-git-revision-date-localized-plugin
339345
- git-revision-date-localized:
340346
enable_creation_date: true

‎poetry.lock‎

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

‎pyproject.toml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ pyyaml = "^6.0"
3636
cmem-cmempy = "^25.3.0"
3737
pydantic = "^2.11.7"
3838
jinja2 = "^3.1.6"
39-
# Zensical is pre-1.0: the caret pin resolves to >=0.0.64,<0.0.65, i.e. a single
39+
# Zensical is pre-1.0: the caret pin resolves to >=0.0.67,<0.0.68, i.e. a single
4040
# release. This narrowness is intentional -- bump it manually and re-run
4141
# `task build` plus `tools/check_zensical_output.py` when doing so.
42-
zensical = "^0.0.64"
42+
zensical = "^0.0.67"
4343

4444
[tool.poetry.group.dev.dependencies]
4545
linkcheckmd = "^1.4.0"

‎tools/check_zensical_output.py‎

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import re
2323
import sys
2424
from pathlib import Path
25-
from urllib.parse import urljoin
25+
from urllib.parse import unquote, urljoin, urlparse
2626

2727
import click
2828
import yaml
@@ -59,6 +59,7 @@
5959
)
6060
# <link rel="canonical"> and friends are metadata, not asset loads.
6161
LINK_META_RE = re.compile(r'rel="(canonical|alternate|manifest)"', re.IGNORECASE)
62+
OG_IMAGE_RE = re.compile(r'<meta property="og:image" content="([^"]+)"')
6263
TAGS_LISTING_RE = re.compile(r'<h2 id="tag:([^"]+)"')
6364
# Zensical (0.0.58+) renders tag chips as links to their /tags/ listing anchor
6465
# natively; this just asserts every chip's target actually exists there.
@@ -244,11 +245,49 @@ def check_external_assets(pages: list[Path]) -> None:
244245
report("external-assets", True, "no unexpected third-party hosts", required=True)
245246

246247

248+
def check_social_cards(site: Path, pages: list[Path]) -> None:
249+
"""Every content page carries an og:image whose card was written to site/."""
250+
with_card = 0
251+
missing: list[str] = []
252+
dangling: dict[str, str] = {}
253+
for page in pages:
254+
body = page.read_text(encoding="utf-8", errors="replace")
255+
# Redirect stubs and the 404 page get no card.
256+
if REFRESH_RE.search(body) or page == site / "404.html":
257+
continue
258+
found = OG_IMAGE_RE.search(body)
259+
if not found:
260+
missing.append(page.relative_to(site).as_posix())
261+
continue
262+
with_card += 1
263+
path = unquote(urlparse(html.unescape(found.group(1))).path)
264+
# site_url's path and, in MIKE_DOCS_VERSION builds, the version lead the
265+
# URL path but are not directories in site/ - drop segments until it lands.
266+
segments = path.strip("/").split("/")
267+
if not any((site / "/".join(segments[i:])).is_file() for i in range(len(segments))):
268+
dangling.setdefault(path, page.relative_to(site).as_posix())
269+
270+
report(
271+
"social-cards",
272+
with_card > 0 and not missing,
273+
f"og:image on {with_card} page(s)"
274+
if not missing
275+
else f"{len(missing)} page(s) without og:image, e.g. " + ", ".join(missing[:3]),
276+
required=True,
277+
)
278+
report(
279+
"social-cards-resolve",
280+
not dangling,
281+
"every og:image card exists in site/"
282+
if not dangling
283+
else f"{len(dangling)} card(s) missing from site/, e.g. "
284+
+ ", ".join(f"{u} (on {p})" for u, p in sorted(dangling.items())[:3]),
285+
required=True,
286+
)
287+
288+
247289
def check_pending(site: Path, pages: list[Path]) -> None:
248290
"""Features still missing from Zensical - warn only, never fail."""
249-
social = sum(1 for p in pages if 'property="og:image"' in p.read_text(encoding="utf-8", errors="replace"))
250-
report("social-cards", social > 0, f"og:image on {social} pages (backlog #37)", required=False)
251-
252291

253292
revision = sum(1 for p in pages if "Last update" in p.read_text(encoding="utf-8", errors="replace"))
254293
report("revision-dates", revision > 0, f"last-update on {revision} pages (backlog #18)", required=False)
@@ -283,6 +322,7 @@ def check_zensical_output(site_dir: str, config_file: str) -> None:
283322
check_comments(site, pages)
284323
check_external_assets(pages)
285324
check_tag_chip_links(site, pages)
325+
check_social_cards(site, pages)
286326
print()
287327
check_pending(site, pages)
288328
print()

0 commit comments

Comments
 (0)