Automatically add rel="nofollow" to external links
Hi all,
As the title suggest, I need a solution that will automatically add the attribute 'rel="nofollow"' to any external links that are added to an Umbraco site by a user.
The site is running in version 4.0.2.1 and a solution for this version would be preffered.
Could this be accomplished using Xslt or maybe a user control?
Depends very much on how you're rendering stuff (but you probably know that).
Your proposed solution would work for all Richtext Editors IF you we're using something like this approach for those. (Problem is they're saved as plain text, so you can't use XSLT like that out of the box).
For links created with the URL Picker or similar, you could use a similar approach (using an include file with a "link"-moded template for building links...)
But as noted, it's not possible to make sure you catch every single link, unless you know exactly how everything is rendered from your macros/templates etc.
Automatically add rel="nofollow" to external links
Hi all,
As the title suggest, I need a solution that will automatically add the attribute 'rel="nofollow"' to any external links that are added to an Umbraco site by a user.
The site is running in version 4.0.2.1 and a solution for this version would be preffered.
Could this be accomplished using Xslt or maybe a user control?
I thought about the following:
...
<xsl:template match="a" mode="html" priority="1">
<a rel="nofollow">
<xsl:apply-templates select="* | @* | text()" mode="html"/>
</a>
</xsl:if>
</xsl:template>
Hi Jamie,
Depends very much on how you're rendering stuff (but you probably know that).
Your proposed solution would work for all Richtext Editors IF you we're using something like this approach for those. (Problem is they're saved as plain text, so you can't use XSLT like that out of the box).
For links created with the URL Picker or similar, you could use a similar approach (using an include file with a "link"-moded template for building links...)
But as noted, it's not possible to make sure you catch every single link, unless you know exactly how everything is rendered from your macros/templates etc.
/Chriztian
is working on a reply...