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

SEO: do not display any tags in post titles display in meta tags #13986

Merged
merged 1 commit into from
Nov 21, 2019

Conversation

jeherve
Copy link
Member

@jeherve jeherve commented Nov 7, 2019

Fixes 4478-gh-jpop-issues

Changes proposed in this Pull Request:

Some plugins use the the_title filter to add HTML to post titles (to add schema.org metadata for example).
We consequently cannot assume anything returned by get_the_title() will be safe to display in a meta tag.
Let's use the_title_attribute() instead to avoid having any unwanted HTML.

Testing instructions:

  • Start from a site running Jetpack Premium and where you've set posts to use a custom meta tag in SEO settings in Calypso:
    image

  • Install the Easy Digital Downloads plugin

  • Create a Download

  • View it, and check the meta tag.

    • Without this patch, you will see HTML like so:
<title>&lt;span itemprop="name"&gt;A test download&lt;/span&gt; and Testing Jetpack and Testing Jetpack</title>
  • With the patch, the HTML disappears.

Proposed changelog entry for your changes:

  • SEO Tools: do not display any tags in post titles display in meta tags.

Fixes 4478-gh-jpop-issues

Some plugins use the the_title filter to add HTML to post titles (to add schema.org metadata for example).
We consequently cannot assume anything returned by get_the_title() will be safe to display in a meta tag.
Let's use the_title_attribute() instead to avoid having any unwanted HTML.
@jeherve jeherve added [Type] Bug When a feature is broken and / or not performing as intended [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. [Feature] SEO Tools Tools for improving a site's search engine optimization. labels Nov 7, 2019
@jeherve jeherve added this to the 8.0 milestone Nov 7, 2019
@jeherve jeherve requested a review from a team November 7, 2019 15:34
@jeherve jeherve self-assigned this Nov 7, 2019
@matticbot
Copy link
Contributor

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

@jetpackbot
Copy link

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: December 3, 2019.
Scheduled code freeze: November 26, 2019

Generated by 🚫 dangerJS against 05545a4

@ChaosExAnima ChaosExAnima added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. labels Nov 20, 2019
@jeherve jeherve merged commit 4dddd80 into master Nov 21, 2019
@jeherve jeherve deleted the fix/seo-tags-titles branch November 21, 2019 08:57
@matticbot matticbot added [Status] Needs Changelog and removed [Status] Ready to Merge Go ahead, you can push that green button! labels Nov 21, 2019
jeherve added a commit that referenced this pull request Nov 25, 2019
jeherve added a commit that referenced this pull request Nov 25, 2019
* 8.0 Release: running changelog

* Changelog: add #13921

* Changelog: add #13980

* Changelog: add #13905

* Changelog: add #13971

* Changelog: add #13984

* Changelog: add #14009

* Changelog: add #13620

* Remove things that will ship in 7.9.1

* Changelog: add 7.9.1 release (#14044)

* Changelog: add base for 7.9.1 release

* Update release date and post link

* Changelog: add #14066

* Update changelog for 7.9.1

* Changelog: add #13405

* Changelog: add #13841

* Changelog: add #13924

* Changelog: add #13986

* Changelog: add #14010, #14028, #14053, #14055.

* Changelog: add #14054

* Changelog: add #14031

* Changelog: add #14039

* Changelog: add #14050

* Changelog: add #14070

* Changelog: add #14082

* Changelog: add #14084

* Changelog: add #14111

* Changelog: add #13961

* Changelog: add #14047

* Changelog: add #14091

* Changelog: add #14108

* Changelog: add #14121
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] SEO Tools Tools for improving a site's search engine optimization. Touches WP.com Files [Type] Bug When a feature is broken and / or not performing as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants