Copied to clipboard

Flag this post as spam?

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


  • Nergal 6 posts 27 karma points
    Aug 02, 2010 @ 15:01
    Nergal
    0

    False NiceUrl for Subpage

    Hi there,

    I'm having a very strange issue. Sometimes the first subpage gets a false url assigend. My structure looks something like that:

    Main
    +-Home
    +-Otherpage
    +-Otherpage2

    Sometimes I get a url like: /main/home.aspx (which won't function) and sometimes I get the correct /home.aspx

    Umbraco Version: 4.5.1
    Asp.net: 4.0
    Windows: 6.1 + IIS7

    Thanks in advance for solving this issue :)

    Cheers
    Nergal

  • Sascha Wolter 615 posts 1101 karma points
    Aug 02, 2010 @ 16:00
    Sascha Wolter
    0

    Hi Nergal,

    Did you set any hostnames on your nodes via right-click -> Manage Hostnames? In your web.config file to what value is the 'umbracoHideTopLevelNodeFromPath' set?

    Do you mean by assigned that on the properties tab for the first subnode you get the wrong url displayed under 'Link to document'?

    What happens if you republish the entire site (right-click on top node -> 'Republish entire site')?

    Sascha

  • Nergal 6 posts 27 karma points
    Aug 02, 2010 @ 20:32
    Nergal
    0

    Hi,

    I register 2 hostnames for that page.

    the value for umbracoHideTopLevelNodeFromPath is true

    yes, on the properties tab there it gets shown with /main/home.aspx and in my navigation-xslt

    If I republish the singel site or the entire site I get the correct url. But after a while it returns to /main/....

    Thank You :)

    Cheers Nergal

  • Sascha Wolter 615 posts 1101 karma points
    Aug 03, 2010 @ 11:59
    Sascha Wolter
    0

    Hm, that is indeed very odd. If you set the hostname on the main node e.g. www.somename.com the homepage should have the link www.somename.com/home.

    I just gave that a try on my local installation, created the structure

    test
    - test1
    - - test2

    and set the hostname on test to 'www.somedomain.com'. The alternative url was generated on test2 as 'http://www.somedomain.com12', which isn't correct. However browsing to /test1/test2 worked fine. I got the feeling that this might indeed be a bug.

  • Nergal 6 posts 27 karma points
    Aug 03, 2010 @ 20:51
    Nergal
    0

    If you like to, I could give you access to my umbraco installation so you can have a closer look.

    For the moment I would be very happy with a workaround :) Any ideas?

  • Sascha Wolter 615 posts 1101 karma points
    Aug 04, 2010 @ 12:52
    Sascha Wolter
    0

    I can have a look if you like, though I doubt I can do much but it can't hurt either I guess. Feel free to send me the login details to sascha at publiczone.co.uk. Installing the formidable Config Tree package by Tim would be a good idea as well.

    The only thing I can think of for a work around would be to use the xsl replace function whenever you are creating links via xslt, e.g.

    <a href="{Exslt.ExsltStrings:replace(umbraco.library:NiceUrl(@id), 'main/', '')}">somelink</a>

    You can also create a global xslt file and create a new template in there which you can call then whenever you create a link:

    <xsl:template name="CreateLink">
      <xsl:param name="id">
      <xsl:if test="$id != ''">
        <a href="{Exslt.ExsltStrings:replace(umbraco.library:NiceUrl($id), 'main/', '')}">somelink</a>
      </xsl:if>
    </xsl:template>

    Wherever you want to use this you need to add and import (or include) statement like so:

    <xsl:import href="../xslt/Global.xslt" />

    You can then call the template as if it were in your current xslt:

    <xsl:call-template name="CreateLink">
      <xsl:with-param name="id" select="@id" />
    </xsl:call-template>

    It's not ideal but should work for link creation and as long as the page is actually accessible under /home.aspx.

    Sascha

     

  • Dennis Milandt 190 posts 517 karma points
    Aug 31, 2010 @ 10:38
    Dennis Milandt
    0

    I can confirm this issue.

    I have a website with just one root node, and assigned a host name for the root node.

    Home
    - Products
    - - Car

    Sometimes the NiceUrl property includes the urlname of the root node, where www.domain.com/products/car becomes www.domain.com/home/products/car

    It is quite annoying :-)

    umbracoHideTopLevelNodeFromPath is true

    useDomainPrefixes is true

    I have no idea how to work around this other than writing my one GetNiceUrl method to replace the urlname for the root node before returning the url.

    /Dennis

  • Bo Petersen 28 posts 61 karma points
    Oct 14, 2010 @ 19:16
    Bo Petersen
    0

    I got the very same issue with version 4.5.1. I have no workaround either. i have installed Ucomment and the list of comments also share the same bug. PLEASE HELP fixing this.

    im running 5 sites with subdomains prefix set to true, and this just comes up randomly, but only on subnodes.

    Og hej Dennis, håber alt er vel, er lige blevet Level2 certificeret. Hilsen Bo/Synergi1.dk

  • Bo Petersen 28 posts 61 karma points
    Oct 14, 2010 @ 21:23
    Bo Petersen
    0

    Found a simple XSLT workaround, NOT elegant, and can be heavy when referencing many nodes, but nontheless, it works :-)  

    Just add "?debug=whatever" to your url to see it in action and to simple debug

        <xsl:variable name="node" select="$currentPage/@id" />
        <xsl:variable name="topnode" select="$node/ancestor-or-self::node[@level = 1]/@urlName" />
        <xsl:variable name="fullpath" select="umbraco.library:NiceUrlFullPath($node/@id)" />
        <xsl:variable name="newpath" select="umbraco.library:Replace($fullpath, concat('/', $topnode,'/'), '/')" />

        <xsl:if test="umbraco.library:Request('debug') != ''">
          node<textarea><xsl:value-of select="$node" />&nbsp;</textarea><br />
          topnode<textarea><xsl:value-of select="$topnode" />&nbsp;</textarea><br />
          fullpath<textarea><xsl:value-of select="$fullpath" />&nbsp;</textarea><br />
          newpath<textarea><xsl:value-of select="$newpath" />&nbsp;</textarea><br />
          <hr/>
        </xsl:if>


    <a href="{$newpath}">your working url</a>

    You can use it the same way, as Sascha Wolter proposed

Please Sign in or register to post replies

Write your reply to:

Draft