Skip to content

organization @id honoured by every reference (1.9.0) - #5

Open
jeffreyaven wants to merge 1 commit into
mainfrom
feature/organization-id
Open

jeffreyaven wants to merge 1 commit into
mainfrom
feature/organization-id

Conversation

@jeffreyaven

Copy link
Copy Markdown
Contributor

Why

Part A of the provider-microsite structured-data pilot. Provider microsites (<slug>-provider.stackql.io) belong to stackql.io and should name its Organization (https://stackql.io/#organization) rather than describe a second one. The node's @id could already be overridden through themeConfig.structuredData.organization (it is spread last), but every reference was hard-coded to ${siteConfig.url}/#organization, so an override left publisher pointing at a node that is not in the graph.

Work order coverage

Item Status
1. Compute organizationId once, after validation Done. resolveOrganizationId in src/lib.js; computed in src/index.js right after the other config-time validators.
2. Use it for the node (281), WebSite.publisher (301), buildNativeArticleSupplement (812), Article/TechArticle publisher (855) Done. No other #organization literal remains in src/.
3. Validate at config time: absolute http(s) IRI Done. validateOrganizationId: parsed with new URL, protocol http: or https:. Relative, fragment-only, protocol-relative, other schemes, empty string, null and non-strings fail with a message naming themeConfig.structuredData.organization['@id']. Only undefined counts as unset.
4a. Default output still matches test/fixtures/graphs-1.7.1.json Done. The existing fixture test passes unchanged; a new test also checks that setting @id to the default produces byte-identical HTML to leaving it unset.
4b. Override on another origin: every publisher and the supplement reference it, no ${siteConfig.url}/#organization anywhere Done, in both ignore and reuse modes. The test walks every publisher in each graph (6 per mode: WebSite on four pages plus the two articles) and asserts the default id is absent from the whole page HTML, not just the plugin's graph.
4c. Invalid IRI fails at config time Done (test/organization.test.js, test/lib.test.js).
5. README note under "Organization contact details"; CHANGELOG 1.9.0 under Added, default output unchanged Done. Also the configuration reference row for organization and the Validation section.
6. Merge and publish 1.9.0 For Jeff. package.json and the lockfile are at 1.9.0.

Validation

  • npm test: 62 pass, 0 fail (54 before, 8 added).
  • The five new override and validation tests fail against the 1.8.0 source and pass on this branch.
  • git diff --check clean.

Not in this PR, per the work order: the jsdom replacement and any change to the SoftwareSourceCode @id.

🤖 Generated with Claude Code

themeConfig.structuredData.organization['@id'] could already override the
Organization node's own @id (the block is spread last), but WebSite.publisher,
the Article/TechArticle publisher and the native-article supplement stayed
hard-coded to <siteConfig.url>/#organization. The id is now computed once
after validation and used everywhere the organization is named.

A set organization['@id'] must be an absolute http(s) IRI; anything else
fails at config time. Without it the output is byte-identical to 1.8.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant