Link Picker: Use Homepage badge instead of Page if Homepage#75929
Link Picker: Use Homepage badge instead of Page if Homepage#75929
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Size Change: +21 B (0%) Total Size: 6.84 MB
ℹ️ View Unchanged
|
getdave
left a comment
There was a problem hiding this comment.
Thanks for jumping on this so quicky.
One thing that's bothering me is that the "homepage" in WordPress has a special meaning. After all it can be set to something other than the root of the domain.
If we look at the homepage block we will see it fetches the homepage rather than the siteUrl: packages/block-library/src/home-link/edit.js.
I think we can only label as "Home" if it matches the home_url(). What do you think?
Oh that's a great catch. That makes this a bugfix IMO. SiteURL is the site install location and not the root domain that displays the page. If someone installs in a subdirectory (https://my-site.com/wordpress) and outputs their site at the root (https://my-site.com) then I believe all of the internal/external badges will compute incorrectly. I've updated to using the home url. |
ab407f7 to
1f4604c
Compare
|
I removed the homeURL vs siteURL fix, as that's a separate bug that should get backported. I don't know that this homepage one is enough of an issue to warrant backporting for 7.0. Opened the homeUrl update as a separate PR: #75978 |
1f4604c to
c4eb948
Compare
|
Possibly related to #50171 |
What?
Clarifies and improves the link picker's badges to include a "Homepage" for links matching the site url or
/.Why?
Make it clearer where the link is going.
How?
Identify if the link is the homepage by comparing the given link to the siteUrl. I added a new
isHomepagefunction with unit tests to verify functionality.Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast