How to check the page I am currently visiting and set different properties to meta elements?
I am using AddThis.com code snippet on my website. I created a xslt file which is set on header of master template to generate relevant meta tags for facebook. Moreover, below the code checks only news node but I have differents nodes and document types in my content tree as well. What I would like to do is to check the page I am currently visiting (not only news) and set title, description and image for that page by checking document type and its properties.
Whoops - the "Do anything page-specific" comment was supposed to be *above* the apply-templates instruction. It doesn't change anything, but now it looks like you need to do something at that point. It's just explains what the following line does.
How to check the page I am currently visiting and set different properties to meta elements?
I am using AddThis.com code snippet on my website. I created a xslt file which is set on header of master template to generate relevant meta tags for facebook. Moreover, below the code checks only news node but I have differents nodes and document types in my content tree as well. What I would like to do is to check the page I am currently visiting (not only news) and set title, description and image for that page by checking document type and its properties.
Any ideas?
Hi ds,
In my projects I usually have a macro called headContent, which starts out something like this:
/Chriztian
Whoops - the "Do anything page-specific" comment was supposed to be *above* the apply-templates instruction. It doesn't change anything, but now it looks like you need to do something at that point. It's just explains what the following line does.
/Chriztian
Thanks for the feedback Chriztian,
I am not familiar with xslt much. Hence, I will look and try to do it cause it seems a bit advanced xslt.
Could you please firstly help with the following? Instead of for-each loop, how could I get only the title, description and image of current page ?
it outputs that;
Hi ds,
Well - the simple fix is to just say:
But you're "iterating" a set that will only ever contain a single element... but it will work for you.
/Chriztian
Hi Chriztian,
That made the trick.
is working on a reply...