2
votes

I am having the above issue when trying to make the home node map to the '/' route in umbraco. I have been following the method used in the 'Hybrid Framework' Package

Hybrid Framework for Umbraco v7 Best Practises

The Structure I have is as follows (Website is in the root of the tree)

Website node
     |
     - Home node
     |
     - Other nodes

I have created a home url provider which returns the correct url, which looks like this;

public string GetUrl(UmbracoContext umbracoContext, int id, Uri current, UrlProviderMode mode)
{
    var content = umbracoContext.ContentCache.GetById(id);
    if (content != null && content.DocumentTypeAlias.ToLower() == "home" && content.Parent != null)
    {
        //The home node will have / instead of /home/.
        return content.Parent.Url;
    }
    return null;
}

When browsing to the home node (in the back office), I check the properties for the url of the item and get the following error;

This document is published but its url would collide with content /Website (id=1083)

I have followed the method from the hybrid framework to the letter, I'm not sure where I have gone wrong.

I've also checked this blog;

urlprovider and contentfinder

I have set the UmbracoInternalRedirectId property on the website node to point to the home node.

Still no clues I can identify. Can anyone help? Many thanks


Edit :

I'm still trying to get to the bottom of this!

I have done as others have suggested with config files, this hasn't worked.

To perhaps get my point across more succinctly I've replicated the fault with a vanilla umbraco install and uploaded it to github;

https://github.com/Aeptitude/BrokenURLUmbraco

It's just using an sdf file as the database which should be included.

There is a root website node and a home node beneath it. There is an umbracointernalredirectid pointing to the home node beneath. The HomeUrlProvider is set as indicated in my original post. If someone could grab this and help me out, it would be fantastic. The username is admin and the password is password11

Many thanks.

3

3 Answers

5
votes

You can also enable umbracoHideTopLevelNodeFromPath property in web.config to have path generated with all the levels in the tree.

If you want to keep your domains in generated urls, you can enable it using useDomainPrefixes setting in umbracoSettings.config file.

As it's described in other answers as well - using your custom URL provider you need to make sure that only one node will receive the same URL - what is exactly covered by settings described above when it comes to default Umbraco behaviour.

3
votes

To solve your problem, changed back the umbracoHideTopLevelNodeFromPath app-key settings to true:

<add key="umbracoHideTopLevelNodeFromPath" value="true" />

Also make sure to change the useDomainPrefixes to true. in your /Config/umbracoSettings.config file,

<useDomainPrefixes>true</useDomainPrefixes>

Then after that, make sure you re-publish all nodes affected. Then your problem may solved

1
votes

It's because you're giving the home node the same URL as it's parent node in your URL provider, which results in two nodes with the same URL.

To do what you want, make the WEBSITE Node the home page, and have the other nodes beneath it. No need for a custom URL Provider, e.g.

Website/Home
    - About Us
    - Contact Us
    - Etc

This way the home page will be on the / URL, and everything else will be beneath it.