fix(publish): expose the public path to publish.html filters - #579
Draft
Mariomarquezt wants to merge 4 commits into
Draft
Mariomarquezt wants to merge 4 commits into
Mariomarquezt wants to merge 4 commits into
Conversation
Completes the publish.html `path` context from CoreBunch#297 on current main: - Branch preview (added after CoreBunch#297) now passes the visitor's pathname. - Admin entry preview reports the encoded URL pathname, matching live, baked and branch-preview renders (e.g. /posts/caf%C3%A9). - Entry SEO tests added on main after CoreBunch#297 now pass the required url. - republish.ts imports buildPageFrame through the @core/templates barrel. - Docs: branch preview runs the publish.* hooks; the publish pipeline and republishAll rows match the code.
8 tasks done
This branch has not been deployed
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.
Summary
Closes #225.
publish.htmlfilters get{ pluginId, siteId, pageId, slug }. For an entry route (a blog post rendered through its entry template),pageIdandslugare the template's, so a plugin cannot tell which post it is rendering.This adds
pathto the filter context: the rendered page's public URL pathname (for example/posts/hello-world, and/for the home page).slugstays the page or template identity. A plugin can resolve the entry frompath.This builds on #297 by @EuanTop, rebased onto current main. His three commits are kept as he wrote them, with only merge conflicts resolved. One extra commit on top:
/posts/caf%C3%A9), the same value live, baked and branch-preview renders report.url.republish.tsimportsbuildPageFramethrough the@core/templatesbarrel.publish.*hooks; the publish-pipeline andrepublishAllrows indocs/features/publisher.mdmatch the code.Every render path that reaches
applyPublishedHtmlPipelinenow setspath: live requests, full and per-row bakes, background republish, branch preview, and admin preview. 404 renders report/404.Verification
bun run buildbun test— 7055 pass, 1 fail. The failure isno-circular-dependencies.test.tshitting its 15 s timeout on my machine (madge alone reports no cycles). It fails the same way on a cleanmaincheckout.bun run lintNew tests: branch preview reports
/posts/<slug>,/aboutand/with the template slug kept; admin preview reports the encoded path for acaféslug. Both were watched failing before the fix.Checklist