Repository navigation
Fix twitter-card image size tags and options - #15085
Merged
Merged
Conversation
With site-url set and both social cards enabled, a page image Quarto can measure gets twitter:image-height and twitter:image-width tags. Twitter Cards define no image size tags, only twitter:image and twitter:image:alt, so the measured size belongs on og:image alone.
With site-url set, the size measured from a local PNG or JPEG image was written to every social metadata provider, and the twitter provider passed the keys through unchanged as twitter:image-height and twitter:image-width. Twitter Cards define only twitter:image and twitter:image:alt for images, so the size now goes to Open Graph alone, as og:image:height/width. The PNG case dates back to 2021 and shows in 1.10; measuring JPEG images in this release extended it to JPEG. A test page relying on the site image covers the fallback path too.
twitter-card accepted image-width and image-height because it shared its options with open-graph, so they showed in the reference although Twitter Cards have no image size tags and nothing ever read them (#12014). Removing them outright would fail the render of any config setting them, as twitter-card is a closed object. They now move to open-graph, stay accepted on twitter-card as hidden options (no completion, and the reference generator skips hidden options), and setting them prints a deprecation warning pointing to open-graph. A future version can drop them. The warning test renders the file alone: warnOnce is per process, so a project pre-render would consume the message.
Removing the hidden twitter-card image-width and image-height later would turn a harmless no-op into a failed render, while keeping them hidden costs nothing (the legacy archive_* keys stay accepted the same way). The warning now says the options are ignored and points to open-graph, without announcing a removal.
The #15050 entry no longer claims twitter:image gets a height and width, as the measured size now goes to og:image only.
Collaborator
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #15083, from the same pass over the
image-*options.With
site-urlset, the size Quarto measures from a local PNG or JPEG image was written to every social metadata provider. The twitter provider passed it through astwitter:image-heightandtwitter:image-width, which are not Twitter Card tags: Twitter Cards define onlytwitter:imageandtwitter:image:altfor images. The PNG case dates back to 2021, and #15050 extended it to JPEG. Crawlers ignore unknown meta names, so the impact is cosmetic. The measured size now goes toog:image:heightandog:image:widthonly.The
twitter-cardimage-widthandimage-heightoptions come from the same mix-up (#12014).twitter-cardshared its options withopen-graph, so the two showed in the reference although nothing reads them. They move toopen-graph. Ontwitter-cardthey stay accepted as hidden options, since it is a closed object and removing them would turn a harmless no-op into a failed render for any config that sets them. Setting them prints a warning that they are ignored and points toopen-graph, without announcing a removal.The #15050 changelog entry no longer claims
twitter:imagegets a height and width.Checklist
I have (if applicable):
AI-assisted PR
Note: autonomous AI agents submitting PRs without human oversight are not permitted — see the Code of Conduct.
Fixes #12014