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

Show "rich" meta data about remote URL when adding URLs as links #31466

Closed
1 of 3 tasks
getdave opened this issue May 4, 2021 · 8 comments · Fixed by #31464
Closed
1 of 3 tasks

Show "rich" meta data about remote URL when adding URLs as links #31466

getdave opened this issue May 4, 2021 · 8 comments · Fixed by #31464
Labels
[Feature] Link Editing Link components (LinkControl, URLInput) and integrations (RichText link formatting)

Comments

@getdave
Copy link
Contributor

getdave commented May 4, 2021

What problem does this address?

Currently when adding a link in the editor, you see a series of results based on whatever you type into the search field.

Screen Shot 2021-05-04 at 15 24 14

These are different depending on what text you enter and the component tries to "intelligently" discern whether you are:

  1. Directly entering a URL
  2. Searching for a WordPress entity (eg: Post, Page, Category...etc).

When you enter a direct URL such as www.wordpress.org (note the www. is required) then the UI simply displays a single result which is a facsimile of what you entered:

Screen Shot 2021-05-04 at 15 26 12

This is ok, but it could be better and provide better visual confirmation.

What is your proposed solution?

I'm proposing we make both:

  1. the search results
  2. the selected link details

...a little "richer" by enhancing them with meta data from the remote URL such as:

  • <title> tag contents.
  • favicon/site icon.
  • Contents of <meta name="description" /> tag.

Here's an example of that

Screen.Capture.on.2021-05-04.at.15-38-05.mov

This would provide a visual confirmation to the user that they have entered a valid URL and that it is the one they are expecting.

Also here is a screenshot showing where we have opportunity to make the selected link details richer:

Screen Shot 2021-05-04 at 15 36 19

...for example of how this could look here is what Google Docs shows:

Screen Shot 2021-05-04 at 15 55 24

I see this purely as a progressive enhancement - ie: if we cannot enhance the given entry then we simply display the experience as it is now. However, if we do manage to get data then we can enhance the search result.

We already have the REST API endpoint to get the data (I'm currently working on making it return more data) so it's about wiring things together and getting a good UX design.

Todo

@getdave
Copy link
Contributor Author

getdave commented May 4, 2021

@javierarce I think this could be a really nice enhancement. I wonder would you be able to help with the Design UX here?

@skorasaurus
Copy link
Member

ref #27762

@javierarce
Copy link
Contributor

@getdave I love the idea! I'll help you with the design.

@getdave
Copy link
Contributor Author

getdave commented May 4, 2021

Screen.Capture.on.2021-05-04.at.16-49-16.mov

Here's an example of use fetching details for the link preview to provide a richer experience.

Obviously, it has some glitches, but essentially you see the url (which is what we store in the Gutenberg data) whilst the request goes out to fetch the "rich" data. Once that request completes then the UI updates to show the "rich data".

I'm experimenting in #31464

@getdave getdave changed the title Show meta data about remote URL when adding URLs as links Show "rich" meta data about remote URL when adding URLs as links May 4, 2021
@javierarce
Copy link
Contributor

javierarce commented May 5, 2021

Ok, here's the first iteration of this feature's design.

This is the basic add flow where the user searches for an item and we show a list of results. If the text happens to be an URL, we fetch the metadata and render a card (at this point, I wonder if it would be OK to fetch the metadata when the search term doesn't begin with www.)

Steps

The most notable changes I'm introducing are:

  • In the current design, the items from the autocomplete are contained inside a card whose background changes on hover. I think we could get rid of the effect and highlight the titles instead (that said, I've explored a couple of variations here)
  • I've also removed the icon that indicates that a link will get open on a new page. I think this would add a lot of noise in a section containing an avatar and the edit button.

Here are a table with the possible variations depending on what kind of data is available:

Design

I'm a bit unsure about the Press ENTER to add this link help text. I think it works fine when there isn't an image, but when there's one, it gets kind of sandwiched between the image and the title.

This Figma prototype lets you play with the different types of cards.

Screen.Recording.2021-05-05.at.17.46.27.mov

@paaljoachim paaljoachim added the [Feature] Link Editing Link components (LinkControl, URLInput) and integrations (RichText link formatting) label May 6, 2021
@getdave
Copy link
Contributor Author

getdave commented May 10, 2021

@javierarce This is really great - thanks so much for this work and insight.

I like the way the different card options allow for a progressively enhanced approach with increasing levels of fidelity. This is very important as it's not guaranteed that we can fetch metadata in every case.

For a v1 I'm going to propose we go with Favicon + Title + Description. This should be easy enough to parse by enhancing the existing endpoint. I'm thinking grabbing a suitable image will be more difficult so that could a v2 enhancement - I really like the way it looks. Do you agree?

I'll start by enhancing the existing REST API endpoint and then try to pull some of that work into #31464 which is a PoC PR which already does some of what you are planning here.

@javierarce
Copy link
Contributor

For a v1 I'm going to propose we go with Favicon + Title + Description. This should be easy enough to parse by enhancing the existing endpoint. I'm thinking grabbing a suitable image will be more difficult so that could a v2 enhancement -

That's perfect!

@getdave
Copy link
Contributor Author

getdave commented May 19, 2021

I'm currently working on improving the endpoint parsing capabilities in #31763

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)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants