Skip to content

Phase 3: Signposting Link headers and link elements - #292

Merged
neuromechanist merged 2 commits into
feature/issue-284-epic-agent-readinessfrom
feature/issue-287-phase3-signposting
Sep 3, 2026
Merged

neuromechanist merged 2 commits into
feature/issue-284-epic-agent-readinessfrom
feature/issue-287-phase3-signposting

Conversation

@neuromechanist

Copy link
Copy Markdown
Contributor

Adds FAIR Signposting (https://signposting.org, RFC 8288) link relations to the dataset detail page: cite-as, describedby (x2), item, license, type (x2), and author (bounded).

src/lib/signposting.ts is a new pure module, no I/O, following the same one-model-two-renderers discipline as use-this-data.ts and jsonld.ts. buildSignposting produces a typed array of relations from data the dataset page already has in hand; signpostingLinkHeader serializes that array as the HTTP Link header field value, and the identical array is passed straight into Base.astro's existing headLinks prop (from phase 2) for the <link> elements. No second prop was added to Base.astro.

Every relation degrades to omission, never a null or empty href, when its source is missing: no concept DOI omits cite-as; no selected version omits item; a free-text (non-URI) license omits license. describedby and type are unconditional since they're deterministic from the dataset id and the page's own class.

cite-as uses the concept DOI (never a version DOI), computed the same way jsonld.ts computes its identifier field, so the two can never disagree about which DOI is "the" one. license reuses ccLicenseUrl from jsonld.ts rather than re-deriving the CC mapping.

Gating: none added. A private dataset already 404s upstream (both the landing and metadata fetches fail) before the page renders anything, so it never reaches the signposting builder, and the earlier commit's curl evidence below confirms no Link header and no <link> elements are emitted for one.

Parity: every relation lands in headLinks alongside the header, so nothing is header-only, hidden, or user-agent-gated. cite-as, item, license, and the second describedby (the catalog record) already appear as visible text elsewhere on the page (phase 2's "Use this data" section, AuthorList.astro for author ORCIDs); this phase's <link> elements are additionally now visible in page source for every relation, metadata.json included.

Author bound

MAX_SIGNPOSTING_AUTHORS = 25. The Link header is a single HTTP header field value, and edge proxies/CDNs commonly cap one at a low number of KB (e.g. nginx's 8 KB large_client_header_buffers default). Each ORCID relation serializes to roughly 60 bytes, so 25 caps that portion at about 1.5 KB, comfortably under budget alongside every other relation this module emits. Every real fixture captured for this phase (nm000103's 8 ORCID-bearing authors is the largest) sails under the bound untouched; it exists for an unbounded consortium-scale dataset. The full author list still renders unbounded elsewhere on the page (AuthorList.astro); only the head/header surface is capped. Tested in signposting.test.ts by feeding the builder more authors than the bound and asserting the output stops at exactly 25.

Test plan

  • bun run lint -- clean (0 errors)
  • bun run typecheck -- clean (0 errors, pre-existing unrelated hints only)
  • bun run test -- 1550 passed (64 files), including 24 new tests in src/lib/signposting.test.ts
  • NEMAR_SKIP_OG_GENERATE=1 bun run build -- succeeds

Curl evidence against bun run dev, real production data (nm000103 / nm099999):

$ curl -sD- -o /dev/null http://localhost:4321/dataset/nm000103 | grep -i '^link:'
link: <https://doi.org/10.82901/nemar.nm000103>; rel="cite-as", <https://data.nemar.org/nm000103/metadata.json>; rel="describedby"; type="application/json", <https://api.nemar.org/datasets/nm000103>; rel="describedby"; type="application/json", <https://data.nemar.org/nm000103/v2.0.0/>; rel="item", <https://creativecommons.org/licenses/by-nc-sa/4.0/>; rel="license", <https://schema.org/Dataset>; rel="type", <https://schema.org/AboutPage>; rel="type", <https://orcid.org/0000-0001-5557-259X>; rel="author", <https://orcid.org/0000-0002-1552-1090>; rel="author", <https://orcid.org/0000-0003-4232-3169>; rel="author", <https://orcid.org/0000-0003-3218-9226>; rel="author", <https://orcid.org/0000-0003-4540-3551>; rel="author", <https://orcid.org/0000-0002-0799-3557>; rel="author", <https://orcid.org/0000-0003-3532-1210>; rel="author", <https://orcid.org/0000-0002-9048-8438>; rel="author"

$ curl -s http://localhost:4321/dataset/nm000103 | grep -o '<link rel="cite-as"[^>]*>'
<link rel="cite-as" href="https://doi.org/10.82901/nemar.nm000103">

$ curl -s http://localhost:4321/dataset/nm000103 | grep -o '<link rel="describedby"[^>]*>'
<link rel="describedby" href="https://data.nemar.org/nm000103/metadata.json" type="application/json">
<link rel="describedby" href="https://api.nemar.org/datasets/nm000103" type="application/json">

$ curl -sD- -o /dev/null http://localhost:4321/dataset/nm099999 | head -1
HTTP/1.1 404 Not Found

$ curl -sD- -o /dev/null http://localhost:4321/dataset/nm099999 | grep -ci '^link:'
0

Base and merge order

This branch was cut from feature/issue-286-phase2-use-this-data (it already needed phase 2's headLinks seam), so this PR targets that branch, not dev. I'll retarget to the epic branch once phase 2 merges.

Closes #287

Part of epic #284

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 3, 2026 •

Copy link
Copy Markdown

@neuromechanist
neuromechanist force-pushed the feature/issue-287-phase3-signposting branch from 69f43ce to 2f72593 Compare September 3, 2026 11:02
@neuromechanist
neuromechanist changed the base branch from feature/issue-286-phase2-use-this-data to feature/issue-284-epic-agent-readiness September 3, 2026 11:02
@neuromechanist
neuromechanist merged commit ab98b25 into feature/issue-284-epic-agent-readiness Sep 3, 2026
5 of 9 checks passed
@neuromechanist
neuromechanist deleted the feature/issue-287-phase3-signposting branch September 3, 2026 11:20
neuromechanist added a commit that referenced this pull request Sep 3, 2026
…lms.txt (#294)

* Phase 1: AI crawler tokens in robots.txt and a real-lastmod sitemap (#290)

* Allow AI crawlers in robots.txt

* Add real-lastmod sitemap.xml route

* Add tests and fixture for robots/sitemap

* Move escapeXml to a neutral xml module

* Assert the crawler block stays contiguous

* Reuse isManagedDatasetId in the sitemap filter

* Skip the sitemap on noindex hosts

* Phase 2: server-rendered Use-this-data section and .md mirror (#291)

* lib: export license helpers from jsonld

* types: add zarr status fields to Dataset

* lib: add use-this-data model and tests

* add UseThisData section component

* layout: add generic headLinks to Base

* dataset: render Use this data section

* dataset: add markdown mirror endpoint

* fix: render Use this data outside unpublished ternary

* fix: make page unpublished flag authoritative

* fix: mark up commands and URLs, not sentences

* Phase 6: nemar.org llms.txt and a footer link (#293)

* Add /llms.txt endpoint with tests

* Link llms.txt from the footer

* Fix llms.txt license claim, was off by 10x

* Give llms.txt search link a working q example

* Require v prefix on llms.txt version placeholder

* Un-link llms.txt dataset-page placeholder

* Phase 3: Signposting Link headers and link elements (#292)

* lib: add signposting link model and tests

* dataset: emit Signposting Link header and tags

* Rewrite Zarr recipe to be index-agnostic

* Correct the download facts and add a cd step

* Check value/note discipline in every section

* Cite the published version, not the selected one

* Number both references; soften sparse access

* Escape interpolated text in the .md mirror

* Validate ORCIDs and reject unsafe Link hrefs

* Strip a trailing slash from the .md alternate

* Split Applebot out and pin robots groups

* Cache robots and llms.txt; noindex the mirror

* Add route tests for the four new routes

* Cite sources for the routing and ORCID notes
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