I think you need to describe a little bit more detailed what you want the macro to do. You just want to output a title, and some meta tags or whats your plan?
I think you should be off with a good starting point in using Razor by having a look at the videos at umbraco.tv. These can be found here: http://umbraco.com/help-and-support/video-tutorials/umbraco-fundamentals at the bottom of the page. It will require a subscription to watch them though, but there's lots of good stuff going on there at umbraco.tv :-)
SEO Macro in Razor
could any one help me in creating an seo script using razor
Hi Mohammed
I think you need to describe a little bit more detailed what you want the macro to do. You just want to output a title, and some meta tags or whats your plan?
/Kim A
actually i need to convert this xslt to razor .
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp " ">
]>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets"
exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:param name="currentPage"/>
<xsl:variable name="title" select="umbraco.library:Replace(umbraco.library:Replace(umbraco.library:StripHtml($currentPage/title),'
',''),'
','')" />
<xsl:variable name="description" select="umbraco.library:Replace(umbraco.library:Replace(umbraco.library:StripHtml($currentPage/description),'
',''),'
','')" />
<xsl:variable name="bodyText" select="umbraco.library:Replace(umbraco.library:Replace(umbraco.library:StripHtml($currentPage/bodyText),'
',''),'
','')" />
<xsl:variable name="keywords" select="umbraco.library:Replace(umbraco.library:Replace(umbraco.library:StripHtml($currentPage/keywords),'
',''),'
','')" />
<xsl:variable name="noIndex" select="$currentPage/noIndex" />
<xsl:template match="/">
<!-- start writing XSLT -->
<title>
<xsl:choose>
<xsl:when test="$title !=''">
<xsl:value-of select="$title" disable-output-escaping="yes"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$currentPage/@nodeName"/>
</xsl:otherwise>
</xsl:choose>
</title>
<meta name="description">
<xsl:attribute name="content">
<xsl:choose>
<xsl:when test="$description !=''" >
<xsl:value-of select="$description" disable-output-escaping="yes"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="umbraco.library:TruncateString($bodyText, '160', '')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</meta>
<meta name="keywords">
<xsl:attribute name="content">
<xsl:value-of select="$keywords" disable-output-escaping="yes"/>
</xsl:attribute>
</meta>
<xsl:if test="$noIndex = '1'">
<meta name="robots" content="noindex" />
</xsl:if>
</xsl:template>
</xsl:stylesheet>
Hi Mohamed,
I think you should be off with a good starting point in using Razor by having a look at the videos at umbraco.tv. These can be found here: http://umbraco.com/help-and-support/video-tutorials/umbraco-fundamentals at the bottom of the page. It will require a subscription to watch them though, but there's lots of good stuff going on there at umbraco.tv :-)
All the best,
Bo
is working on a reply...