Fix ViewPostButton to show for all published posts#979
Open
Conversation
…okup
The button was using getCanonicalUrlForSlug() which searches the navigation
menu — but most posts aren't in navigation, so the button never rendered.
Now constructs the URL directly as /{center}/blog/{slug}.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Preview deployment: https://live-page-button-posts.preview.avy-fx.org |
rchlfryn
requested changes
Mar 7, 2026
Collaborator
rchlfryn
left a comment
There was a problem hiding this comment.
Looks good - can we add a test?
…t documents Tests verify the globe button appears on published posts/pages and is hidden on draft documents. Draft tests unpublish a document, assert the button is gone, then re-publish to restore state. Also fixes the button's id attribute to use a stable test selector. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Collaborator
Author
Tests added 🕺 |
rchlfryn
approved these changes
Mar 9, 2026
Collaborator
There was a problem hiding this comment.
⛏️ There are a lot of comments in this file. Do we want that?
I am fine either way but I think test variable should help explain what is happening which they do.
Collaborator
Author
There was a problem hiding this comment.
Cleaned up the comments a bit. A lot of them felt helpful to me but I see your point. Hopefully this is a nice middle ground.
…n failures + use a longer timeout for published assertion
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.
Description
The ViewPostButton (live page button on Posts) was using
getCanonicalUrlForSlug()which searches the navigation menu for the post's slug. Since most blog posts aren't linked in navigation, the function returnednulland the button never rendered. This fix constructs the URL directly as/{center}/blog/{slug}, matching the actual route pattern.Related Issues
Closes #709
Key Changes
getCanonicalUrlForSlugdependency — posts don't need navigation lookup since they always live at/blog/{slug}depthfrom 2 to 0 (onlyslug,_status, andtenantare needed)_statuscheck beforeresolveTenant()to avoid unnecessary work for draft postsHow to test
pnpm devand navigate to/admin/{center}/blog/{slug}in a new tabScreenshots / Demo video
Migration Explanation
No migration needed — this is a UI-only change.
Future enhancements / Questions