Problem/Motivation

As you can see in #3038799: BC for Drupal\Component\Utility\EmailValidator (<8.7.x), the title of the issue is BC for Drupal\Component\Utility\EmailValidator (<8.7.x) and the page title (i.e. <title>) has the correct value. Hoever the metatag title has <meta property="og:title" content="BC for Drupal\Component\Utility\EmailValidator (" />

P.S: First of all, I couldn't find any issues related to this and the closest issue is #2402211: META: Add appropriate meta tags to drupal.org for all entities and I am going to add this as a child.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Comments

vijaycs85 created an issue. See original summary.

drumm’s picture

Title: Metatag og:title is broken on issues when title contains special characters » og:title is cut off when title contains “<text”
Project: Drupal.org customizations » Metatag
Version: 7.x-3.x-dev » 8.x-1.x-dev
Issue tags: +affects drupal.org, +Needs tests

This happens with metatag_opengraph, and even the title tag itself, on a clean install. A node with title “Test < one <two” becomes “Test < one” for both the head_title title tag, and og:title. Notice that a space after the < does not trigger removal, only < immediately followed by a character.

(www.drupal.org does not have the <title> symptom on issues because project_issue module overrides head_title, https://cgit.drupalcode.org/project_issue/tree/project_issue.module#n1458)

In DrupalDefaultMetaTag::tidyValue(), if I comment out

    // Remove any HTML code that might have been included.
    $value = strip_tags($value);

this is worked around, but that would have side effects.

#3030181: Filter JavaScript, style content out of values before they're output is a recent issue in the same function, it might help show the types of tests to write. A regexp-based replacement to strip_tags() would be potentially effective and likely messy.

drumm’s picture

Version: 8.x-1.x-dev » 7.x-1.x-dev
vijaycs85’s picture

Status: Active » Needs review
Issue tags: -Needs tests
StatusFileSize
new755 bytes
new50.32 KB

Thanks, @drumm for further investigation and moving to this module. Here is the test to prove this issue. As it's a test-only patch, expect to fail.

Status: Needs review » Needs work

The last submitted patch, 4: 3038838-test-only-4.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

damienmckenna’s picture

Status: Needs work » Needs review
StatusFileSize
new1.21 KB

Does simply removing the strip_tags() call fix this?

Status: Needs review » Needs work

The last submitted patch, 7: metatag-n3038838-7.patch, failed testing. View results

damienmckenna’s picture

So the short answer is: yes.

The longer answer is: we need to make sure that HTML can't leak through unwanted to accidentally close the META tags and let other output show up on the page.

damienmckenna’s picture

Another issue is that strip_tags() currently removes the standard HTMl that can be added to the output of field tokens, I'm not sure it's possible to distinguish between wrapper HTML on field output and the field values.

This is where it starts getting complicated.

damienmckenna’s picture

bluegeek9’s picture

Status: Needs work » Closed (outdated)
Issue tags: -affects drupal.org
//www.flaticon.com/free-icons/thank-you Thank you for your contribution!
Unfortunatly Drupal 7 is no longer supported. We encourage you to upgrade to a modern version of Drupal.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.