The zen_process_html_tag() function removes $tag['#attributes']['type'] if it does not equal "text/ng-template". The only problem is that it will remove the attribute when it equals "application/ld+json" which breaks the output from the Schema.org Metatag module.

Issue fork zen-2934644

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

DamienMcKenna created an issue. See original summary.

damienmckenna’s picture

Status: Active » Needs review
StatusFileSize
new837 bytes

This patch changes zen_process_html_tag() so it won't remove the type="application/ld+json" attribute.

damienmckenna’s picture

Marko B’s picture

I confirm this patch works, should be put into main branch asap.

steinmb’s picture

Status: Needs review » Reviewed & tested by the community

Read through issue linked to in #4, lets address it in here.

damienmckenna’s picture

StatusFileSize
new833 bytes

For anyone who needs this for 7.x-5.5.

anybody’s picture

Just for others who should run into this issue: AdaptiveTheme has the same problem:

process.inc, line 47ff.:

/**
 * Process variables for the html tag
 */<em></em>
function adaptivetheme_process_html_tag(&$vars) {
  $tag = &$vars['element'];
  if ($tag['#tag'] === 'style' || $tag['#tag'] === 'script') {
    // Remove redundant type attribute and CDATA comments.
    unset($tag['#attributes']['type'], $tag['#value_prefix'], $tag['#value_suffix']);
    // Remove media="all" but leave others unaffected.
    if (isset($tag['#attributes']['media']) && $tag['#attributes']['media'] === 'all') {
      unset($tag['#attributes']['media']);
    }
  }
}
Fabrice Chaillou’s picture

StatusFileSize
new843 bytes

Patch for 6.4.

kunal_sahu made their first commit to this issue’s fork.

kunal_sahu’s picture

Hi This patch applied cleanly.

PS C:\xampp\htdocs\drupal\web\themes\custom\zen-2934644> git apply -v .\zen-n2934644-6.4.patch
Checking patch template.php...
Hunk #1 succeeded at 224 (offset -19 lines).
Applied patch template.php cleanly.
PS C:\xampp\htdocs\drupal-9.5\web\themes\custom\zen-2934644> git status
On branch 2934644-dont-remove-typeapplicationldjson

LGTM.

Creating an MR for helping the maintainer. Thanks