Problem/Motivation

The Meta tags module should generate uniform contents. By uniform contents, I mean exactly the same contents as everywhere else. For example, applying relevant filter modules on fields used for tags generation.

To get an idea of what I am requesting, please proceed as follow:

  1. Enable the PHP Filter module
  2. Edit/create a text format using the PHP Filter module
  3. Edit/create a node with a body, using the Text Format mentioned above for the body
  4. In the summary of the body, write some PHP code that outputs some contents, for example:
    echo 'Hello world!';
  5. In the Meta tags tab, make sure the description is set to [node:summary]
  6. Save your changes
  7. Look at the HTML source of the page. Instead of being executed by the PHP Filter module, the PHP code has been escaped as if it was plain HTML. You will see something like: <meta name="description" content="&lt;?php echo 'Hello world!'; ?&gt;"> instead of the expected <meta name="description" content="Hello world!">

Proposed resolution

The Meta tags module should make use of the same code than the rest of the system to get the same generated contents. In all cases, strip_tags must be maintained on the generated value since we cannot have HTML tags inside HTML attributes and the <title> element.

CommentFileSizeAuthor
#3 metatag-n1917902-3.patch346 bytesdamienmckenna

Comments

damienmckenna’s picture

Version: 7.x-1.0-beta4 » 7.x-1.x-dev
Priority: Normal » Major

Ok, I've confirmed this - Metatag shows the PHP code itself while the node teaser shows the correct output of the PHP. I'll need to discuss it with Dave.

dave reid’s picture

Yeah that's actually unfortunate that those tokens have to return the raw values. Maybe the best option is to use 'sanitize' => TRUE, because we do reverse the effects of check_plain() with the decode_entities() call, so that should be ok. It just might require some testing with lots of various tokens to confirm that this change is ok and doesn't cause regressions.

damienmckenna’s picture

Status: Active » Needs review
StatusFileSize
new346 bytes

Ok, lets start here.

Krizalys’s picture

Issue summary: View changes

Typo

Krizalys’s picture

Issue summary: View changes

Typo

damienmckenna’s picture

Status: Needs review » Fixed

Committed. This will need to be highlighted in the release notes.

Krizalys’s picture

Thanks, it's a great improvement.

damienmckenna’s picture

Status: Fixed » Closed (fixed)

Now that Metatag v7.x-1.0-beta5 is out am closing this to keep the issue queue clean.

damienmckenna’s picture

Issue summary: View changes

Hidden content