Hi, I have been trying to create an XSLT to show different meta descriptions depending on the page they are on. I have my XSLT how I want it but I can't work out how to make it show as the meta description. I tried the following in my master template:
But that did not work either, I even replaced the less than and greater than signs for their HTML equivalent. I did search the forum and found a post that seemed to match what I was trying to do but for some reason all the important bits (the code) was not visible? Not sure if there is an issue with the forum, the post was: http://our.umbraco.org/forum/developers/xslt/1462-meta-data
Meta description macro
Hi, I have been trying to create an XSLT to show different meta descriptions depending on the page they are on. I have my XSLT how I want it but I can't work out how to make it show as the meta description. I tried the following in my master template:
but it just gave the following output on the page:
<meta name="description" content="<umbraco:Macro Alias="Meta-description" runat="server"></umbraco:Macro>" />
I then tried adding the following in my XSLT:
<xsl:text>
<meta name="description" content='
</xsl:text>
***XSLT to get description***
<xsl:text>
' />
</xsl:text>
But that did not work either, I even replaced the less than and greater than signs for their HTML equivalent. I did search the forum and found a post that seemed to match what I was trying to do but for some reason all the important bits (the code) was not visible? Not sure if there is an issue with the forum, the post was: http://our.umbraco.org/forum/developers/xslt/1462-meta-data
Try this in your XSLT file:
Hi
I think you might be able to render the macro by writing it like this
<meta name="<umbraco:Macro Alias="Meta-description" insertTextBefore="content="" insertTextAfter=""" runat="server"></umbraco:Macro>" />
Does it help?
/Jan
Do you have the meta description stored in the umbraco node? I.e. as a property for each page?
If so, you can just use the umbraco item like this:
Hi Tom,
Thanks that has worked perfectly.
is working on a reply...