-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Edit Site: Update template navigation to use new link control. #20366
Edit Site: Update template navigation to use new link control. #20366
Conversation
Size Change: +41 B (0%) Total Size: 864 kB
ℹ️ View Unchanged
|
Whats the use-case in which I'd want to edit a Template from within the context of the link editor? |
That's not what this is doing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is cool!
So I can go to the Site Editor and edit a template-part. From here I can add a link to the front-page template (link defined to /
), and then navigate to that template in the site editor via that link. Fantastic! 🎉
What I am having issues with is creating a second template (call it 'second-page') in here and adding a link to that second template (link defined to lead to /second-page
?):
- It seems to go to the front-page template either way,
- and that second template does not seem to persist in the Site Editor's list of templates when I go back into the Site Editor later (although it did get added to the list of 'templates' in the 'appearance' section).
Are these behaviors expected at this point and/or represent future work to be done in follow ups?
It needs to be published to be part of the hierarchy. |
Thanks for the info!
If I go to "Appearance" -> "Templates" (or similarly "Template Parts"), there are Templates / Template Parts that are listed as "Published" that do not appear in the selection dropdown in the Top-Left of the site editor. Is there something else I need to do for them to be "published" where the Site Editor is concerned?
I am struggling to find how to set up a second page to render another template in for the sake of testing this nifty template navigation even further. Do you happen to have any other info on this? I just got done going through the most recent gutenbrerg times demo with no luck, is there anything else that may highlight this? |
They need to be part of the resolved hierarchy somehow.
Make a |
So I made a
added a link in the header to |
There was a bug with URLs with query strings. I just fixed it, and it works well now. Thanks for catching it! |
import { pencil } from '@wordpress/icons'; | ||
import { createSlotFill, ExternalLink, Button } from '@wordpress/components'; | ||
import { ExternalLink, Button } from '@wordpress/components'; | ||
import { safeDecodeURI, filterURLForDisplay } from '@wordpress/url'; | ||
import { useMemo } from '@wordpress/element'; | ||
|
||
const { Slot, Fill } = createSlotFill( 'BlockEditorURLPopoverLinkViewer' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the URLPopover
has been replaced, why do we need to make changes to this file?
Could there be any cases where this is still used where removing this slot may cause issues?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was only added for this, so I am reverting it here before anyone gets a chance to use it.
This is working great! I am about ready to approve, but just have the question about about the |
Answered 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works great and is a really awesome feature to have working in the Site Editor!
Thanks for all your effort 😄
59cdd3e
to
5432e83
Compare
Description
#19141 was merged with a feature to navigate to the template that an internal link will use to render its front end, using the
URLPopover
.The
URLPopover
has since been replaced with theLinkControl
. This PR moves the slot/fill extension introduced by #19141 to the newLinkControl
component.How has this been tested?
It was verified that the feature works as expected with the new
LinkControl
.Screenshots
Checklist: