Skip to content

fix(publish): expose entry public paths to publish filters - #297

Open
EuanTop wants to merge 3 commits into
CoreBunch:mainfrom
EuanTop:fix/publish-filter-public-path
Open

fix(publish): expose entry public paths to publish filters#297
EuanTop wants to merge 3 commits into
CoreBunch:mainfrom
EuanTop:fix/publish-filter-public-path

Conversation

@EuanTop

@EuanTop EuanTop commented Jul 28, 2026

Copy link
Copy Markdown

Summary

  • add the emitted public pathname to the publish.html runtime context and shared publish filter SDK context
  • preserve slug as the rendered page or template document identity
  • derive path from the same route URL used by live rendering, static baking, preview, and background republish
  • document the filter-context semantics and add regression coverage

For entry routes, slug identifies the shared entry template while
path identifies the concrete public artifact, for example
/posts/hello-world.

This allows SEO plugins to generate per-entry canonical and Open Graph URLs
without changing the existing template identity semantics.

Closes #225.

Verification

  • bun run build
  • bun test
  • bun run lint
  • Docker/deployment check, if relevant (not applicable)

Checklist

  • Tests cover behavior changes.
  • Docs were updated when behavior, config, deployment, or public surfaces changed.
  • No compatibility shim was added for old pre-release behavior.
  • No secrets, local databases, uploads, or generated artifacts are included.

Copilot AI review requested due to automatic review settings July 28, 2026 06:30
@EuanTop
EuanTop marked this pull request as ready for review July 28, 2026 06:32

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR extends the publish filter context so publish.html handlers can reliably access the public URL pathname (path) of the emitted page/artefact (especially important for entry/template routes where slug identifies the template document, not the per-entry public route).

Changes:

  • Add path to the renderer output and thread it through the publish.html filter context (bake/live/preview/republish flows).
  • Update plugin SDK types and documentation to define the slug vs path semantics for entry routes.
  • Add regression coverage asserting path is present for both / and entry routes.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/core/plugins/hookBus.ts Updates inline docs for filter context extras.
src/core/plugin-sdk/types/hooks.ts Introduces a shared PublishFilterContext including path for publish filters.
src/tests/server/publicRendering.test.ts Ensures hookBus state is reset per test; asserts publish filter context includes path for /.
src/tests/server/cmsTemplateRoutes.test.ts Adds regression test that entry route renders provide path (and keep template slug).
src/tests/architecture/publish-html-filter-context.test.ts Updates test description to reflect path being part of the expected context contract.
server/publish/republish.ts Changes background republish to use a page permalink-derived synthetic URL.
server/publish/publishedHtmlPipeline.ts Passes path into the publish.html filter context extras.
server/publish/publicRenderer.ts Makes url mandatory in render contexts and reports path via url.pathname on renderer output.
server/plugins/protocol/messages.ts Updates protocol docs for filter context fields.
server/handlers/cms/data/preview.ts Adds path to preview renderer output fed into the shared publish pipeline.
docs/features/publisher.md Documents publish.html filters receiving { siteId, pageId, slug, path }.
docs/features/plugin-system.md Adds canonical URL example using path and documents slug vs path semantics.

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

Comment thread server/publish/republish.ts
Comment thread docs/features/plugin-system.md Outdated
Copilot AI review requested due to automatic review settings July 28, 2026 07:15

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

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

Comments suppressed due to low confidence (1)

src/tests/architecture/publish-html-filter-context.test.ts:7

  • The header comment overstates what this architecture gate enforces. The test only checks that applyFilter('publish.html', ...) is called with a third argument, not that the context contains specific keys like path. Reword the comment to match the actual guarantee (presence of a context argument), while still noting that handlers commonly destructure { siteId, pageId, slug, path }.
 * This ensures that plugin filter handlers for `publish.html` always receive
 * `{ siteId, pageId, slug, path }` in their context — without this, plugins that
 * destructure those fields would silently receive `undefined`.

Copilot AI review requested due to automatic review settings July 28, 2026 07:23

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

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

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.

publish.html filter context lacks the page's public path (entry routes report the template slug)

2 participants