-
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
NavigationLink: make the URL dynamic for links to Posts #18345
Comments
@getdave How big of a change do you think it would be to let navigationLink handle post objects? |
@retrofox Can I clarify that you are suggesting that when you search for the One thing that strikes me is that in any implementation we should be careful about ensuring that we're not coupling the Editor too tightly to WordPress. I'll put this on my list to investigate tomorrow. I'd also recommend we get some insight from @youknowriad as he and I were discussing something similar on his |
This feels related to the discussion we had here #19462 (comment) basically LinkControl should be able to handle different "type" of links. Relative or not. The value should always provide the "URL" if needed (for example the link format in paragraph blocks will always store URLs) but the Navigation block could decide to store the "relative" link (couple id + type) |
Thanks all. Personally, I feel it would be useful to document what would be involved in this and what different scenarios we'd need to cover.
|
Thanks, @getdave to taking over of this one. 👍 I think @youknowriad already brought a nice path to take here. |
As part of this we should also set |
To have compatibility with menu items, though, we may need to have three attributes which are used to set the dynamic URL. This parallels how menu items are stored in the database.
With only |
Currently the
This means that when the page is rendered the link to the page or post is hardcoded in the block's markup. Therefore if the URL changes the link will be stale. |
Oh... 😬 I misunderstood the issue, apologies and thank you for reopening it @draganescu! |
To quote Riad here.
So what we can look to do is have the Nav Link block avoid storing the URL and instead store the Currently
|
I tried the above once many months ago and it requires significant updates to how link control works. It is the way tho' :) I just wanted to mention it's complicated by how LinkControl works. |
Thanks for the context Andrei. We'll have to dive into LinkControl - luckily I'm pretty familiar with it. |
Related #32282 |
Just walked into this issue with our first Block Theme. Is there currently no way to make the navigation block store links in a relative way instead of the url? The classic menu interface saved items in a relative way, right? I am surprised that this issue is not generating much more attention. |
With "recent" advancements to the Link UI I think we could be in a good place to address this. Here's how:
The UX to figure out is:
Some initial work in #46891 but this would need rebasing and updating. |
The link URL should be generated dynamically, instead of storing the URL as an attribute.
Edit for clarity. To reproduce:
lorem-ipsum
lorem-ipsum
lorem-ipsum
The text was updated successfully, but these errors were encountered: