Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Djan Blom 99 posts 161 karma points
    Apr 20, 2011 @ 10:48
    Djan Blom
    0

    Getting the data from the fields in ver. 4.0.3

    Hi all,

    I followed this thread, http://our.umbraco.org/projects/website-utilities/meta-tags-for-umbraco/meta-tags-for-umbraco-forum/10222-getting-the-data-from-the-fields

    but im still having trouble with getting content into my metatags.

    Ismail wrote that a runat=server tag shoulg not be in the head tag - because it would render the macro's inactive.

    Is this true, and can anyone tell me the correct macro - or just how to make this work?

    <head id="head1" runat="server">



    </head>


    - I've allready created the tabs and generic proberties - and they have the alias metaKeywords and metaDescription.

    Please help :)

    /djan

  • Djan Blom 99 posts 161 karma points
    Jun 14, 2011 @ 11:38
    Djan Blom
    1

    This should work:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
    <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:template match="/">
    <title><xsl:for-each select="$currentPage/ancestor-or-self::node[not(string(./data [@alias = 'PageTitle'])='')]">
    <xsl:sort select="position()" data-type="number" order="descending"/>
    <xsl:if test="position()=1">
    <xsl:value-of select="./data [@alias = 'PageTitle']" />
    </xsl:if>
    </xsl:for-each></title>
    <meta name="keywords">
    <xsl:attribute name="content">
    <xsl:for-each select="$currentPage/ancestor-or-self::node[not(string(./data [@alias = 'Keywords'])='')]">
    <xsl:sort select="position()" data-type="number" order="descending"/>
    <xsl:if test="position()=1">
    <xsl:value-of select="./data [@alias = 'Keywords']" />
    </xsl:if>
    </xsl:for-each>
    </xsl:attribute>
    </meta>
    <meta name="description">
    <xsl:attribute name="content">
    <xsl:for-each select="$currentPage/ancestor-or-self::node[not(string(./data [@alias = 'Description'])='')]">
    <xsl:sort select="position()" data-type="number" order="descending"/>
    <xsl:if test="position()=1">
    <xsl:value-of select="./data [@alias = 'Description']" />
    </xsl:if>
    </xsl:for-each>
    </xsl:attribute>
    </meta>
    </xsl:template>
    </xsl:stylesheet>

  • Djan Blom 99 posts 161 karma points
    Jun 15, 2011 @ 07:50
    Djan Blom
    0

    someone post, so i can mark as solution ?

     

  • Jens S. Nielsen 1 post 21 karma points
    Jun 17, 2011 @ 09:03
    Jens S. Nielsen
    0

    .

Please Sign in or register to post replies

Write your reply to:

Draft