Hi all, tried searching for this, but with no success. Simple(ish) question. I want to be able to set up my template so that it adds the <meta> tags as a chunk, however for index only I want to add the google verify tag. e.g.
if pageid = 1
meta chunk google
meta chunk default
else
meta chunk default
endif
I’d like to extend the principal so that I could deselect my ditto summary pages from the print add-in as well, though to be fair the add-in does work properly, showing no text to print.
Advice thoughts?
TIA
Regards
Thanks, however, at the risk of appearing churlish, does this mean that there’s no ’logic’ functionality within the template system itself? The suggestion does look to be a surprisingly complex approach to deal with, what is, at least in the google case, a single event in a site. Equally, does this imply that I end up with a variable which must be set for each page? Whilst the document describes it as a ’hack’ one can see how some find themselves in multi-template territory.
Any other thoughts, suggestions, or clarifications if I’ve missed the point herein.
Regards
Maybe something like this is what you are looking for, create a snippet and add one call to the top of your template where the code needs to be inserted.
<?php
/* Google_Meta
* create new snippet with this code
* add the uncached snippet to the top of the normal template where you want the output to appear
ex: [!Google_Meta!] - (set the default in the snippet)
or pass the snippet an ID [!Google_Meta? &tID=`1`!]
*/
// check if an ID was sent, if not use default (1)
$targetID = isset($tID)? $tID : '1';
$output ='';
// gets the current page id
$cpID = $modx->documentIdentifier;
// compare ID's, if they match echo the output
if($cpID == $targetID){
$output .='Google Meta code here which will print';
//or
$output .='{{GoogleMetaChunkName}}';
}
return $output;
?>
Hope this helps