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

Set OpenGraph title meta attribute on search pages. #14746

Merged

Conversation

coleshaw
Copy link
Contributor

@coleshaw coleshaw commented Feb 20, 2020

Fixes #14677

Changes proposed in this Pull Request:

  • Adds an OpenGraph title metadata tag based on the search terms, to the search results page.

Is this a new feature or does it add/remove features to an existing part of Jetpack?

  • Adds a feature to the existing OpenGraph component.

Testing instructions:

  • Go to a WP post. View the source and see in the head section a set of meta tags for OpenGraph, including a descriptive og:title tag.
  • Search for a term. In the search results page, view the source and look in the head section again for meta tags. You should find an og:title one with a value of Search results for "{search term}" - {site name}.

The output should look like:

<!-- Jetpack Open Graph Tags -->
<meta property="og:title" content="Search Results for “foo” – blah">
<meta property="og:site_name" content="blah">
<meta property="og:image" content="https://s0.wp.com/i/blank.jpg">
<meta property="og:locale" content="en_US">

<!-- End Jetpack Open Graph Tags -->

Proposed changelog entry for your changes:

  • Adds OpenGraph title attribute to the search results page.

@jetpackbot
Copy link

jetpackbot commented Feb 20, 2020

Thank you for the great PR description!

When this PR is ready for review, please apply the [Status] Needs Review label. If you are an a11n, please have someone from your team review the code if possible. The Jetpack team will also review this PR and merge it to be included in the next Jetpack release.

Scheduled Jetpack release: March 3, 2020.
Scheduled code freeze: February 25, 2020

Generated by 🚫 dangerJS against 20c3363

@jeherve jeherve added [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Feature] Sharing Post sharing, sharing buttons labels Feb 20, 2020
functions.opengraph.php Outdated Show resolved Hide resolved
functions.opengraph.php Show resolved Hide resolved
@jeherve jeherve added the [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! label Feb 20, 2020
functions.opengraph.php Outdated Show resolved Hide resolved
@coleshaw
Copy link
Contributor Author

I've updated the original PR comment with the expected meta tags. wp_get_document_title() seems to work well.

@jeherve jeherve added this to the 8.3 milestone Feb 21, 2020
@matticbot
Copy link
Contributor

Caution: This PR has changes that must be merged to WordPress.com
Hello coleshaw! These changes need to be synced to WordPress.com - If you 're an a11n, please commandeer, review, and approve D39210-code before merging this PR. Thank you!

@jeherve jeherve added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! labels Feb 21, 2020
@jeherve jeherve self-assigned this Feb 21, 2020
Copy link
Member

@jeherve jeherve left a comment

Choose a reason for hiding this comment

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

This works well in my tests. Merging.

@jeherve jeherve merged commit 81f7ec4 into Automattic:master Feb 21, 2020
@matticbot matticbot added [Status] Needs Changelog and removed [Status] Ready to Merge Go ahead, you can push that green button! labels Feb 21, 2020
@jeherve
Copy link
Member

jeherve commented Feb 21, 2020

Internal reference: r203217-wpcom

jeherve added a commit that referenced this pull request Feb 25, 2020
jeherve added a commit that referenced this pull request Feb 25, 2020
* 8.3 release: changelog

* Changelog: add #14516

* Changelog: add #14574

* Bring in changes from 8.2.1 and 8.2.2

* Update stable version

* Bring in 8.2.3 changes

* Changelog: add #14714

* Changelog: add #14639

* Changelog: add #14678

* Changelog: add #14673

* Changelog: add #14687

* Changelog: add #14704

* Changelog: add #14702

* Changelog: add #14541

* Changelog: add #14657

* Changelog: add #14622

* Changelog: add #14582

* Changelog: add #14638

* Changelog: add #14633

* Changelog: add #14571

* Changelog: add #14592

* Changelog: add #14539

* Changelog: add #14514

* Changelog: add #14643

* Changelog: add #14494

* Changelog: add #13739

* Changelog: add #14707

* Changelog: add #14736

* Changelog: add #14706

* Changelog: add #14730

* Changelog: add #14685

* Changelog: add #14727

* Changelog: add #14711

* Changelog: add #14742

* Changelog: add #14746

* Changelog: add #14725

* Changelog: add #13999

* Changelog: add #14740

* Changelog: add #14759

* Changelog: add #14703

* Changelog: add #14753

* Changelog: add #14754

* Changelog: add #14645

* Cahngelog: add #14599
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Sharing Post sharing, sharing buttons Touches WP.com Files [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OpenGraph: Improve default og:title for search results page
4 participants