x First time here? Check out the FAQ
  • Avatar5posts28karma

    Single Node with Mutiple URLs

    Tomas Breen started this topic More than a year ago , this topic was edited at: Friday, January 08, 2010 1:10 PM, Go directly to the topic solution

    Hi Guys,

    I am building a catalogue of products. Each product will have 3 areas: Overview, Details and Pricing. I would like to be able to fill all this information on a single node, with each area in a different tab.

    How can I do this and have a different url for each area? Like below:

    /products/prod1/overview.aspx
    /products/prod1/details.aspx
    /products/prod1/pricing.aspx

    The reason for this is to make it much easer on the user to create a single product, without having to create 3 nodes below it.

    Thanks in Advance.

     


  • Replies

  • Avatar457posts1443karma
    Comment with ID: 22703
    Hendy Racher posted this reply More than a year ago

    Hi Tomas,

    You could look at adding a url rewrite rule to into the /config/UrlRewriting.config file for your three alternatives, having them point back to /products/prod1.aspx, this would probably be simplier than adding alternative Urls for each node

    HTH,

    Hendy


  • Harald Ulriksen posted this reply More than a year ago

    You could use alternate templates. Create one template for area and then modify the url in the xslt or create a new method in the library which generates the alternate template for you.

    public static string AlternateTemplateUrl(int nodeId, string template)
    {         
    return library.NiceUrl(nodeId).Replace(".aspx", "/" + template);     
    }

    You might want to skip the overview and just use the normale template for it.

    Hth,
    Harald


  • Tomas Breen posted this reply More than a year ago

    Harald,

    Thank you for your reply. I think you are on the right path with this. I am, however, quite new to umbraco. Can you explain where I can extend the library? It may be easier for me to modify the XSLT, can you give me an example?

    Regards,

    Tomas


  • Tomas Breen posted this reply More than a year ago

    Harald,

    After a bit of googling, I understand what you are explaining now.

    Any {node}/{templateAlias}.aspx works out of the box and selects the template based on that template alias. Excellent. I love Umbraco.

    Regards,

    Tomas


  • Avatar337posts516karma
    Comment with ID: 22730
    LaurenceG posted this reply More than a year ago

    The above post is a killer tip! :) Sweet, didn't know about this! (i'd thumbs up you, but I don't have enough karma yet!)

    /Laurie


  • Avatar457posts1443karma
    Comment with ID: 22743
    Hendy Racher posted this reply More than a year ago

    Yep nice tip :) no messing with config files, and sperate templates for each - ideal.

    Thanks


  • Tomas Breen posted this reply More than a year ago

    For completeness, here is part of the XSLT I used to achieve the multiple pages per node.

    <ul>
    <xsl:for-each select="$currentPage/ancestor-or-self::node [@level=2]/node [@nodeTypeAlias = $documentTypeAlias and string(data [@alias='umbracoNaviHide']) != '1']">
    <li>
    <a href="{umbraco.library:NiceUrl(@id)}">
    <xsl:value-of select="@nodeName"/>
    </a>
    <ul>
    <li>
    <a href="{umbraco.library:Replace(umbraco.library:NiceUrl(@id), '.aspx', '/details.aspx')}">
    Details
    </a>
    </li>
    <li>
    <a href="{umbraco.library:Replace(umbraco.library:NiceUrl(@id), '.aspx', '/enquiry.aspx')}">
    Enquire</a>
    </li>
    </ul>
    </li>
    </xsl:for-each>
    </ul>

Please login or Sign up To post replies