Copied to clipboard

Flag this post as spam?

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


These support forums are now closed for new topics and comments.
Please head on over to http://eureka.ucommerce.net/ for support.

  • Tim Gow 12 posts 31 karma points
    Mar 06, 2013 @ 13:45
    Tim Gow
    0

    <Title> tags for categories and products

    Does anyone know how I get all my products to have different <Title> tags? Currently all my categories just have 'Catalog' and all my products just have 'Product'.

    My master Umbraco template is using @pageName and this is obviously the problem - how can I get it to say, 'if this page is a catalog or product page, then show the name of the catalog or product'.

    Any help really appreciated!

    Tim

  • Nickolaj Lundgreen 233 posts 1132 karma points
    Mar 06, 2013 @ 13:51
    Nickolaj Lundgreen
    0

    I have added a SEO macro to the headsection of the umbraco master template.

    This macro fecth the relevant information for uCommerce Product/Category/Catalog, and has a fallback with the umbraco pagename etc.

    You can limit this to just the title-tag, but i would advice using a full SEO setup (title, description,keywords and NoIndex).

  • Tim Gow 12 posts 31 karma points
    Mar 06, 2013 @ 21:05
    Tim Gow
    0

    Thanks Nickolaj, appreciated.

    So to get started I created the macro below. I added a defintion for titleTag in my products but it isn't working. I'm pretty new to XSLT by the way...! Can you tell me where I am going wrong? Thanks again!  

    <?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" xmlns:CommerceLibrary="urn:CommerceLibrary" 
      exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets CommerceLibrary ">


    <xsl:output method="xml" omit-xml-declaration="yes"/>

    <xsl:param name="currentPage"/>

    <xsl:template match="/">

    <!-- start writing XSLT -->
    <head>
      <title><xsl:value-of select="titleTag"/></title>
    </head>  
    </xsl:template>

    </xsl:stylesheet>


  • Nickolaj Lundgreen 233 posts 1132 karma points
    Mar 06, 2013 @ 23:11
    Nickolaj Lundgreen
    0

    Unfortunately im not  a XSLT guy (i do all my macros in Razor), so i can't really help you out

  • David Brendel 792 posts 2970 karma points MVP 3x c-trib
    Mar 12, 2013 @ 10:22
    David Brendel
    0

    uCommerce uses some urlrewriting to beautify the urls. If you look at that rules you can see that the category or product page has query parameters in the url for catalog, category (and product).

    You can use this parameter in your xslt macro to fetch the current watched category/product.

    To fetch the product in the macro you have to add it as a parameter. Then where you add your macro you have to insert something like this als the value for the parameter: [@product]. With this the current product will be available in the macro.

    <xsl:variable name="productId" select="/macro/product"/>

    Remember that this is just the id of the product. With that you can use the ucommerce xslt libbrary to get the product.

    Then you can display your html title tag with the custom protperty you added to the definition.

    <title><xsl:value-of select="@titleTag"/></title>

    I'm no xslt ucommerce expert because i also write my stuff in razor. But i think that will guide you in the right direction.

Please Sign in or register to post replies

Write your reply to:

Draft