Skip to content
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

Make the link anchor also retrieve the title of the post/page #11930

Closed
brazenvoid opened this issue Nov 15, 2018 · 4 comments · Fixed by #21240
Closed

Make the link anchor also retrieve the title of the post/page #11930

brazenvoid opened this issue Nov 15, 2018 · 4 comments · Fixed by #21240
Labels
[Feature] Link Editing Link components (LinkControl, URLInput) and integrations (RichText link formatting) General Interface Parts of the UI which don't fall neatly under other labels. Good First Issue An issue that's suitable for someone looking to contribute for the first time Needs Dev Ready for, and needs developer efforts [Type] Enhancement A suggestion for improvement.

Comments

@brazenvoid
Copy link

brazenvoid commented Nov 15, 2018

The linker in current WP gets the title of the searched and selected post/page automatically rather than making the user get it manually himself.

We have recently shifted to Gutenburg and have been crying tears of blood due to this. There are many other quibbles but I guess I can deal with them. We usually release about 15 posts every week.

Now we have to source the post link from the post/page itself or its excerpt to preserve its title. Otherwise, it is such a hassle to form the title from its URL.

Imagine the scenario that you have just released 6 or so posts and updating the table of contents and other sources within the site. Now one will have to open a new tab with the site and copy+paste post title links because the link block doesn't do this.

Solution

Perhaps when no text is selected, the link should instead add the title as the label.

@brazenvoid brazenvoid changed the title Make the link block also retrieve the title of the post/page Make the link anchor also retrieve the title of the post/page Nov 15, 2018
@designsimply designsimply added the Needs Testing Needs further testing to be confirmed. label Nov 16, 2018
@designsimply
Copy link
Member

Tested and confirmed using WordPress 4.9.8 and Gutenberg 4.4 cdeb40986 with the following steps:

  1. Add a paragraph block.
  2. Do not highlight any of the text and then click the link icon in the toolbar.
  3. Search for an existing post, select it, and click the "Apply" button.

Result: I expected the link text to automatically get populated with the title of the post I selected but instead the URL is used for the link text. (43s)

URL is used for link text when an existing post or page is linked to in Gutenberg:

url-is-used-for-link-text-in-gutenberg

Title becomes link text when an existing post or page is linked to in the classic editor:

title-becomes-link-text-in-classic

@designsimply designsimply added [Type] Enhancement A suggestion for improvement. Good First Issue An issue that's suitable for someone looking to contribute for the first time General Interface Parts of the UI which don't fall neatly under other labels. and removed Needs Testing Needs further testing to be confirmed. labels Nov 16, 2018
@mostafaabd
Copy link

@designsimply hi, i test it in Gutenberg 4.5.1, and WordPress 4.9.8, but there is no issue its display title of post not link like this video .

@Arbigaus
Copy link

Arbigaus commented Apr 1, 2019

There's some preview to fix it?
Thanks.

@gziolo gziolo added the Needs Dev Ready for, and needs developer efforts label Apr 10, 2019
@yodiyo
Copy link
Contributor

yodiyo commented May 16, 2019

This is still an issue. It is making more work to add internal links to pages.

@aduth aduth added the [Feature] Link Editing Link components (LinkControl, URLInput) and integrations (RichText link formatting) label Mar 31, 2020
aduth pushed a commit that referenced this issue Apr 1, 2020
…ost (#21240)

* Fix for #11930
Make the link anchor also retrieve the title of the post/page

* Fix long titles
Also made code a bit more readable

* Add test to check link to existing post

* small change in naming
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Link Editing Link components (LinkControl, URLInput) and integrations (RichText link formatting) General Interface Parts of the UI which don't fall neatly under other labels. Good First Issue An issue that's suitable for someone looking to contribute for the first time Needs Dev Ready for, and needs developer efforts [Type] Enhancement A suggestion for improvement.
Projects
None yet
7 participants