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:
- Enable the PHP Filter module
- Edit/create a text format using the PHP Filter module
- Edit/create a node with a body, using the Text Format mentioned above for the body
- In the summary of the body, write some PHP code that outputs some contents, for example:
echo 'Hello world!';
- In the Meta tags tab, make sure the description is set to [node:summary]
- Save your changes
- 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="<?php echo 'Hello world!'; ?>"> 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.
Comments
Comment #1
damienmckennaOk, 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.
Comment #2
dave reidYeah 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.
Comment #3
damienmckennaOk, lets start here.
Comment #3.0
Krizalys commentedTypo
Comment #3.1
Krizalys commentedTypo
Comment #4
damienmckennaCommitted. This will need to be highlighted in the release notes.
Comment #5
Krizalys commentedThanks, it's a great improvement.
Comment #6
damienmckennaNow that Metatag v7.x-1.0-beta5 is out am closing this to keep the issue queue clean.
Comment #6.0
damienmckennaHidden content