Skip to content

feat(core): allow nlweb rel in page:metadata link contributions#523

Merged
ascorbic merged 1 commit into
emdash-cms:mainfrom
jdevalk:feat/nlweb-link-rel
Apr 13, 2026
Merged

feat(core): allow nlweb rel in page:metadata link contributions#523
ascorbic merged 1 commit into
emdash-cms:mainfrom
jdevalk:feat/nlweb-link-rel

Conversation

@jdevalk
Copy link
Copy Markdown
Contributor

@jdevalk jdevalk commented Apr 13, 2026

What does this PR do?

Adds "nlweb" to the PageMetadataLinkRel allowlist so plugins can contribute <link rel="nlweb" href="..."> tags via the page:metadata hook.

Motivation: agent/LLM discovery increasingly uses NLWeb-style link tags to advertise a conversational endpoint for a site. Today a plugin that wants to emit this has no path through the typed page:metadata contribution — the allowlist rejects the rel value at the sandbox boundary in emdash-runtime.ts. An SEO plugin currently being built (seo-graph / emdash-plugin-seo) needs this for parity with what the equivalent Astro integration already does.

Scope: minimal. One entry each in:

  • packages/core/src/plugins/types.tsPageMetadataLinkRel union
  • packages/core/src/emdash-runtime.tsVALID_LINK_REL Set (sandbox-safe allowlist)
  • packages/core/tests/unit/plugins/page-metadata.test.ts — resolve/dedupe test

No behavior change for anything that wasn't rejected before. No new capability, no new hook.

Type of change

  • Feature (small — new allowlist entry, no new API surface)

Opened as draft so the tiny design decision (the value "nlweb" vs. e.g. "service") can be confirmed before merge. Happy to rename if reviewers prefer a more generic rel.

Checklist

  • pnpm typecheck passes (core)
  • pnpm test passes (page-metadata suite: 29/29)
  • pnpm format run
  • Test added (resolves nlweb link for agent discovery)
  • Changeset added (emdash minor — new public API value)

AI-generated code disclosure

  • This PR includes AI-generated code

Part of a small upstream-API series opened in coordination: this (trivial) PR is the only one submitted directly; the related page:robots, notfound, and content:validate hook proposals will come via Discussions first per CONTRIBUTING.md.

Adds "nlweb" to PageMetadataLinkRel and the runtime allowlist so plugins
can inject <link rel="nlweb" href="..."> tags pointing at conversational
endpoints. Mirrors the existing pattern used for other agent-discovery
link types.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 13, 2026

🦋 Changeset detected

Latest commit: 9191289

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 9 packages
Name Type
emdash Minor
@emdash-cms/cloudflare Minor
@emdash-cms/admin Minor
@emdash-cms/auth Minor
@emdash-cms/blocks Minor
@emdash-cms/gutenberg-to-portable-text Minor
@emdash-cms/x402 Minor
create-emdash Minor
@emdash-cms/plugin-embeds Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 13, 2026

Open in StackBlitz

@emdash-cms/admin

npm i https://pkg.pr.new/@emdash-cms/admin@523

@emdash-cms/auth

npm i https://pkg.pr.new/@emdash-cms/auth@523

@emdash-cms/blocks

npm i https://pkg.pr.new/@emdash-cms/blocks@523

@emdash-cms/cloudflare

npm i https://pkg.pr.new/@emdash-cms/cloudflare@523

emdash

npm i https://pkg.pr.new/emdash@523

create-emdash

npm i https://pkg.pr.new/create-emdash@523

@emdash-cms/gutenberg-to-portable-text

npm i https://pkg.pr.new/@emdash-cms/gutenberg-to-portable-text@523

@emdash-cms/x402

npm i https://pkg.pr.new/@emdash-cms/x402@523

@emdash-cms/plugin-ai-moderation

npm i https://pkg.pr.new/@emdash-cms/plugin-ai-moderation@523

@emdash-cms/plugin-atproto

npm i https://pkg.pr.new/@emdash-cms/plugin-atproto@523

@emdash-cms/plugin-audit-log

npm i https://pkg.pr.new/@emdash-cms/plugin-audit-log@523

@emdash-cms/plugin-color

npm i https://pkg.pr.new/@emdash-cms/plugin-color@523

@emdash-cms/plugin-embeds

npm i https://pkg.pr.new/@emdash-cms/plugin-embeds@523

@emdash-cms/plugin-forms

npm i https://pkg.pr.new/@emdash-cms/plugin-forms@523

@emdash-cms/plugin-webhook-notifier

npm i https://pkg.pr.new/@emdash-cms/plugin-webhook-notifier@523

commit: 9191289

@jdevalk jdevalk marked this pull request as ready for review April 13, 2026 12:39
Copilot AI review requested due to automatic review settings April 13, 2026 12:40
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds "nlweb" as an allowed <link rel="..."> value for page:metadata contributions so plugins can emit NLWeb-style discovery links.

Changes:

  • Extend PageMetadataLinkRel to include "nlweb".
  • Extend the sandbox/runtime allowlist (VALID_LINK_REL) to accept "nlweb" across the RPC boundary.
  • Add a unit test asserting resolvePageMetadata preserves an nlweb link contribution.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
packages/core/src/plugins/types.ts Adds "nlweb" to the typed PageMetadataLinkRel union for plugin contributions.
packages/core/src/emdash-runtime.ts Allows "nlweb" through the security-critical sandbox rel allowlist.
packages/core/tests/unit/plugins/page-metadata.test.ts Adds a unit test verifying nlweb link contributions resolve into output links.
.changeset/nlweb-link-rel.md Declares a minor version bump for emdash documenting the new allowed rel value.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Collaborator

@ascorbic ascorbic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@ascorbic ascorbic merged commit 5d9120e into emdash-cms:main Apr 13, 2026
28 of 30 checks passed
@emdashbot emdashbot Bot mentioned this pull request Apr 13, 2026
jdevalk added a commit to jdevalk/emdash-plugin-seo that referenced this pull request Apr 13, 2026
When the new `nlwebEndpoint` setting is populated, metadataHandler
contributes `<link rel="nlweb" href="…">` via the page:metadata hook
so conversational agents can discover the site's chat surface without
scraping HTML.

Requires the EmDash release that contains emdash-cms/emdash#523
(merged upstream). The contribution carries a transient
@ts-expect-error against the currently-published emdash types — it
auto-unblocks once the new emdash version is on npm.

Also adds an "Agent discovery" admin section for the setting and a
tiny parseSettings round-trip test.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
fmhall pushed a commit to fmhall/emdash that referenced this pull request Apr 13, 2026
…emdash-cms#523)

Adds "nlweb" to PageMetadataLinkRel and the runtime allowlist so plugins
can inject <link rel="nlweb" href="..."> tags pointing at conversational
endpoints. Mirrors the existing pattern used for other agent-discovery
link types.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants