Repository navigation
Validate page-level open-graph and twitter-card options - #15084
Merged
Merged
Conversation
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. |
cderv
added a commit
that referenced
this pull request
Oct 16, 2026
cderv
added a commit
that referenced
this pull request
Oct 16, 2026
cderv
force-pushed
the
fix/page-level-open-graph-and-twit
branch
from
October 16, 2026 10:43
ce28a71 to
57249f4
Compare
Page front matter `open-graph` and `twitter-card` are read by the website metadata postprocessor and merged with the `website:` options, and the website docs describe that use. The schema only declared them under `website:`, so at page level a typo was silently ignored, and a wrongly typed value such as `description: 42` crashed the render with `value.trim is not a function` instead of a validation error. The page entries reuse `open-graph-config` and `twitter-card-config`, so both levels accept the same keys. They also accept null: an empty `open-graph:` key is handled by the postprocessor and covered by the
Validating front matter strings against the real front-matter schema checks each case in milliseconds, and a new case is one table row, where the smoke-all documents needed a full render per option. The valid rows guard against the page schema rejecting options the postprocessor reads, including the empty value.
Whether a YAML option is accepted is a schema question; a smoke-all document per value costs a full render each and grows with every option, while a unit test against the real schema is one table row. The schema-validation unit tests load the generated yaml-intelligence-resources.json rather than the .yml source, so a test run before build-artifacts silently checks the old schema; checked by reverting only document-website.yml, after which the new test still passed.
cderv
force-pushed
the
fix/page-level-open-graph-and-twit
branch
from
October 16, 2026 11:26
57249f4 to
de89f53
Compare
3 of 5 tasks
cderv
added a commit
that referenced
this pull request
Oct 16, 2026
…of social metadata (#15091) Pages read `bread-crumbs`, `back-to-top-navigation`, `page-navigation`, `margin-header` and `margin-footer` from their own front matter, but the document schema only declared them under `website:`, so a wrong-typed page value passed validation silently and editors offered no completion. A page `open-graph: false` or `twitter-card: false` also still emitted `og:` or `twitter:` tags when the site enabled them. The provider loop skipped a provider only when both page and site values were falsy, and the merge treats a page `false` like an unset value, so the site won. - Declare the five page-level options in the document schema, with the same types as their `website:` counterparts - Skip a social metadata provider when the page sets it to `false`; an empty page value still falls back to the site setting Related to #15084 See quarto-dev/quarto-web#2297 for the page opt-out documentation
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 #15057, whose
imagedescription now sends users to page-levelopen-graphto declare the preview image size.Page front matter
open-graphandtwitter-cardare read by the website metadata postprocessor and merged with thewebsite:options, as the website tools guide documents. The schema only declared them underwebsite:, so at page level they got no validation and no editor completion. A misspelled option such asimge-widthwas silently ignored, and a value of the wrong type such asdescription: 42crashed the render withTypeError: value.trim is not a function. The same mistakes underwebsite:in_quarto.ymlare reported with a "Did you mean" hint.Fix
Declare both keys in
document-website.yml, reusingopen-graph-configandtwitter-card-config, so a page accepts the same options as the website. An empty value (open-graph:with nothing after it) is accepted too: the postprocessor handles it, and the #12016 tests rely on it.Note
A page or
_metadata.ymlwith an unknown option underopen-graphortwitter-cardused to render, with the option ignored. It now fails validation, as it already does underwebsite:. The changelog entry says so.The tests validate front matter strings against the real schema in a unit test, not with a smoke-all document per value, so another case is one more table row. The testing guidance in
llm-docs/testing-patterns.mdand.claude/rules/now points schema changes to this kind of test. These tests load the generatedyaml-intelligence-resources.json, not the.ymlsource, sodev-call build-artifactshas to run before they see a schema change.The quarto.org format reference is generated from this schema, so it will list both options for pages at the next reference update.
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.