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

URL Details: Update regex to include og:description #35875

Merged
merged 2 commits into from
Oct 26, 2021

Conversation

Mamaduka
Copy link
Member

Description

PR updates regex to include og:description when looking for valid site descriptions.

Fixes #33754.

P.S. Sorry about whitespace changes. Let me know if you want me to revert it.

How has this been tested?

Unit tests are passing.

Types of changes

Enhancement

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • I've tested my changes with keyboard and screen readers.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR (please manually search all *.native.js files for terms that need renaming or removal).

@Mamaduka Mamaduka requested a review from getdave October 22, 2021 10:01
@Mamaduka Mamaduka self-assigned this Oct 22, 2021
@Mamaduka Mamaduka added [Feature] Link Editing Link components (LinkControl, URLInput) and integrations (RichText link formatting) REST API Interaction Related to REST API [Type] Enhancement A suggestion for improvement. labels Oct 22, 2021
Copy link
Contributor

@hellofromtonya hellofromtonya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The og:description regex and associated test data are ready to go. Well done @Mamaduka 🥇 I'm approving this PR for the og:description enhancement.

But I'd suggest reverting the whitespace removal changes to maintain an og:description enhancement atomic commit. Why? Code churn. The whitespace changes do not impact test results, code quality, or the goals of the og:description enhancement.

Thanks @Mamaduka 🙌

@TimothyBJacobs
Copy link
Member

If I'm reading this right, it seems like whether og:description or description is picked is solely based on what comes first in the document. Should we be more intentional and query one of them first?

@getdave
Copy link
Contributor

getdave commented Oct 25, 2021

If I'm reading this right, it seems like whether og:description or description is picked is solely based on what comes first in the document. Should we be more intentional and query one of them first?

Is there any existing pattern in place for preferring og: or otherwise?

IMHO it would seem reasonable to prefer OG and fallback to other options.

@Mamaduka
Copy link
Member Author

@TimothyBJacobs is right.

Value is picked based on what comes first in the document. It is similar to how we get image URLs.

I don't have a strong preference here.

@Mamaduka
Copy link
Member Author

@hellofromtonya, thanks for the review.

I was about to revert trailing whitespace changes, but it looks like settings is set in the project on the .editorconfig level:

trim_trailing_whitespace = true

Reverting changes will mean that we'll get similar unwanted changes tracked in the future.

Copy link
Contributor

@getdave getdave left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Mamaduka If this matches the existing pattern for returning whatever comes first in the document then I'm happy to roll with that.

Nice work here. I'll let others feedback on whitespace as I also have this question in another PR.

@Mamaduka
Copy link
Member Author

Thanks, everyone, for the reviews. I'm going to merge this since trailing whitespace changes matches the editor configuration.

@Mamaduka Mamaduka merged commit bbaff5d into trunk Oct 26, 2021
@Mamaduka Mamaduka deleted the update/url-details-description branch October 26, 2021 14:10
@github-actions github-actions bot added this to the Gutenberg 11.9 milestone Oct 26, 2021
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) REST API Interaction Related to REST API [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

url-details endpoint doesn't look for og:description when searching for a description
4 participants