Expand meta tags for better social media card support#2822
Expand meta tags for better social media card support#2822StevenClontz wants to merge 8 commits intoPreTeXtBook:masterfrom
Conversation
|
Quick visual pass. More in a bit. One question: why change "title-plain" to "title-full". I think the latter will get markup (like emphais and math), and that cannot become the value of an attribute ( |
|
I posted sample output at https://clontz.org/assets/20260407/ (all CSS etc. is broken, I just posted the single HTML file) Here's what I get for the Bluesky card (as expected):
Now that image isn't super high quality. I dunno if there's a better canonical image for a pretext document besides the brand-logo, or if we should use/recommend higher-quality/resolution brand logos for this purpose. |
Was just messing around and didn't remember to change this back. It's now reverted. |
|
(note: SVGs do not work with BlueSky at least, so another recommendation would be to use a high-quality JPG or PNG...) |
|
I'm on a kick with using Claude Code as an assistant. Looks like there might be some useful things to consider in its review. Next comment. |
rbeezer
left a comment
There was a problem hiding this comment.
Summary: Expands the existing OpenGraph <meta> tags to also emit Twitter/X card meta tags, adds og:title, og:description, and twitter:card, and uses docinfo/blurb (already in the dev schema for Runestone) as the description source with subtitle as fallback.
Issues:
-
blurbis dev-schema only. Theblurbelement is defined inpretext-dev.rnc(for Runestone's shelf categorization), not the main schema. This PR repurposes it for social metadata. That's fine conceptually, but it means authors using the stable schema will get validation errors if they add<blurb>to theirdocinfo. Shouldblurbmove to the main schema, or should the PR note this dependency? -
Significant code duplication. The
ogandtwittercalls for title, image, image:alt, and description are nearly identical — differing only in the attribute name (propertyvsname). Thesocial-meta-elementtemplate already handles both via separate$propertyand$nameparams, but each caller duplicates the full block. A loop or a wrapper template that emits both at once would halve the code. -
Title logic is inconsistent. The subtitle is appended to the title only when
$docinfo/blurbexists (<xsl:if test="$docinfo/blurb and $document-root/subtitle">). This means: blurb + subtitle → title is "Title: Subtitle", description is blurb. No blurb + subtitle → title is just "Title", description is subtitle. The subtitle disappears from both when there's no blurb. Should the subtitle always appear in the title regardless of blurb? -
summary_large_imagewithout guaranteed image. The Twitter card type is unconditionally set tosummary_large_image, but the image tag is only emitted when$b-has-baseurl and $docinfo/brandlogo. Without an image,summary_large_imagewill render poorly — Twitter shows a blank image area. Should fall back tosummarywhen there's no image. -
Hard-coded "Document Logo" alt text. The
og:image:altandtwitter:image:altuse the literal string "Document Logo". This isn't localizable and isn't descriptive. Thebrandlogoelement doesn't currently carry alt text, so there may not be a better source, but worth noting. -
Empty comment. Line with just
<!-- -->(the one before "image") — looks like an editing artifact. -
article:authormay not work as expected. The OGP article spec definesarticle:authoras a URL (profile page), not a name string. Passingpersonnameas the content won't produce useful results for Facebook's parser. Thebook:authorproperty has the same issue but was pre-existing.
Minor: The seven incremental commits ("first pass", "fix xsl:if", etc.) could be squashed before merge for a cleaner history.
Claude Opus 4.6, acting as a review assistant for Rob Beezer
|
(1) is not important, and of course, I would squash everyting just as part of my routine. |
😶
C'mon Claude, get your act together. 😅 |
|
b867072 fixes up 2&4&6, the others are hallucinations or wontfix. |

Re: https://groups.google.com/g/pretext-dev/c/pTX_B_EDLWc/m/m7vTCxulBQAJ