Help! Folders and URLs Options
colin.wiseman
Posted: Friday, October 10, 2008 4:51:30 PM

Rank: Enthusiast

Joined: 10/10/2008
Posts: 42
Location: Scotland
Am having great difficulty (and its most likely me being stupid) but i can't seem to create urls with sub directories e.g. :

http://www.mysmallsite.com/somefolder/default.aspx

i created the default.aspx page, fine works. I then wanted to create a folder that, when a user went to it, would show a default page.

I created a folder document type, and added the folder on the same level as my default.aspx page. I then published it, but it created the "Link to document" value of /somefolder.aspx. I created a sub node below that folder default (i.e. the default page of that folder?) and it created a link to document called /default.aspx.

What am i doing wrong in creating sub nodes and sub pages and sub whatevers!?!

HELP!

(why is there no tutorials on this simple steps in creating a new website? or one that i can easily find!)

http://you.arenot.me but if you want to know more about me the checkout http://www.colinwiseman.co.uk.
drobar
Posted: Friday, October 10, 2008 5:26:41 PM

Rank: Umbracoholic

Joined: 9/8/2006
Posts: 1,831
Location: MA, USA
Hi Colin, and welcome to umbraco!

Umbraco 'hides' the top-level nodes of your site from the url by default, though you can change this by altering the <add key="umbracoHideTopLevelNodeFromPath" value="true"/> setting in the /web.config file.

But that's probably a minor point. The bigger issue is to understand how umbraco makes urls. First of all, every node in your content tree has a url to it. It doesn't matter if you call it a folder or a page, it has a url. The url is derived from the path to the node, based on the nodes' names.

Here's a typical umbraco content section and the associated urls (with umbracoHidetopLevelNodeFromPath set to true, the default):
Code:
CONTENT
    - Home (/, or /home.aspx)
        -- Products (/products.aspx)
            --- Phones (/products/phones.aspx)
            --- Batteries (/products/batteries.aspx)
        -- About Us (/about-us.aspx)
        ... etc ...


If you disable the hiding of toplevel nodes, the above urls would become:
Code:

/, or /home.aspx
/home/products.aspx
/home/products/phones.aspx
/home/products/batteries.aspx
/home/about-us.aspx
... etc ...


Umbraco gives nice, friendly urls, which are great for search engine optimization as well as for humans to remember. You don't have to use the cryptic, 'default.aspx' any more.

Hope this helps.

cheers,
doug.

MVP 2007-2009 - Percipient Studios
colin.wiseman
Posted: Monday, October 13, 2008 9:36:12 AM

Rank: Enthusiast

Joined: 10/10/2008
Posts: 42
Location: Scotland
Hi and thanks for the welcome,

Ahh I see what you are doing. Its the "home" that you are disabling. Excellent that will make things more structured. I will look into this now and come back if i have more difficulties.

I actually quite like the "default.aspx" on my pages (even better is the "default.html" but i will look into that at a later date). I also have a need to keep it as I am translating an old site into Umbraco and need to follow the structure exactly.

Cheers

http://you.arenot.me but if you want to know more about me the checkout http://www.colinwiseman.co.uk.
colin.wiseman
Posted: Monday, October 13, 2008 9:46:38 AM

Rank: Enthusiast

Joined: 10/10/2008
Posts: 42
Location: Scotland
Ok, so i now have URLs like "/business/default.aspx" however when i try to land on that page its showing me the "/default.aspx" page instead.

Anything else I have missed?

http://you.arenot.me but if you want to know more about me the checkout http://www.colinwiseman.co.uk.
colin.wiseman
Posted: Monday, October 13, 2008 10:04:09 AM

Rank: Enthusiast

Joined: 10/10/2008
Posts: 42
Location: Scotland
Ok I have done some more testing and it seems the following is true. You cannot have similar page URLs in a branch e.g.

/default.aspx
-------/business/default.aspx
-------/education/default.aspx


This structure (currently but prove me wrong) always chooses the /default.aspx over the correct sub page. I even tested it with:

/default.aspx
-------/business/default.aspx
-------/business/somethingdifferent.aspx
-------/education/default.aspx
-------/education/somethingdifferent.aspx
/somethingdifferent.aspx


and it when i try and navigate to /education/somethingdifferent.aspx it picks up the /somethingdifferent.aspx page instead.

Is there another flag i should know about?


http://you.arenot.me but if you want to know more about me the checkout http://www.colinwiseman.co.uk.
Dirk
Posted: Monday, October 13, 2008 10:14:39 AM

Rank: Umbracoholic

Joined: 9/27/2007
Posts: 1,123
Location: Belgium
Hi Colin,

Append ?umbDebugShowTrace=true to the url.

It should give some more info on how the page is being 'resolved' (How umbraco gets to the page being requested). Look for the 'umbracoRequestHandler' and 'XPath' keywords in there.

Any pointers in there?

I know of a "ensureUniqueNaming" settings in umbracoSettings.config but don't think it has anything to do with your case, as it takes care of ensuring a unique name for pages under the same parent.

Looking forward to your answer.

Regards,
/Dirk


level 1 & 2 certified - umbraco MVP 2008/2009 - umbraco blog at netaddicts.be - working on an integrated forum4umbraco
colin.wiseman
Posted: Monday, October 13, 2008 10:25:02 AM

Rank: Enthusiast

Joined: 10/10/2008
Posts: 42
Location: Scotland
Wow, this is a real quick reply forum! Liking it!

Ok, added the trace to the end of the URL, and this is the first part of it:

Code:
Category        Message
aspx.page        Begin PreInit        
aspx.page        End PreInit
aspx.page        Begin Init
umbracoInit        handling request
request handler        current url '/education/somethingdifferent.aspx'
umbracoRequestHandler    Just before xPath query (True, '1059')
umbracoRequestHandler    After xPath query
umbracoRequestHandler    Access checking started
umbracoRequestHandler    Page not protected
umbracoRequestHandler    Access checking ended
umbracoInit        Done handling request
umbracoPage        Element loaded: MiddleContent
umbracoPage        Pagedata loaded for Somethingdifferent (ID: 1059, Version: 23999edd-60a5-49cc-a347-65daa2cd7404)
umbracoPage        Loading template (ID: 1040)
page            Template loaded
umbracoTemplate        Start parsing
template        Begining of parsing rutine...
umbTemplate        Outputting item: <?UMBRACO_MACRO macroAlias="Navigation">
umbracoMacro        Macro loaded from cache (ID: 2, Navigation)
renderMacro        Rendering started (macro: Navigation, type: 1, cacheRate: 0)
umbracoMacro        Before adding extensions
umbracoMacro        After adding extensions
umbracoMacro        Before performing transformation
umbracoMacro        After performing transformation
template        Begining of parsing rutine...
umbTemplate        Outputting item: <?UMBRACO_MACRO macroAlias="FlashHeader">
umbracoMacro        Macro loaded from cache (ID: 1, Flash Header)
renderMacro        Rendering started (macro: Flash Header, type: 3, cacheRate: 0)
umbracoMacro        Usercontrol added (/usercontrols/flashHeader.ascx)


These two lines are the ones where the engine is picking the page (i believe):

request handler current url '/education/somethingdifferent.aspx'
umbracoRequestHandler Just before xPath query (True, '1059')


But it has definitely picked the wrong page ID. The ID 1059 is the root page called /somethingdifferent.aspx it should have picked up ID 1058. I went into the database and ran the view that the engine calls, and looked at the column named path to be sure i was correct in this, and yes, /education/somethingdifferent.aspx has a path of -1,1041,1057,1058 but the page the engine selects has a path of -1,1059.

Cheers for any help,

Colin



http://you.arenot.me but if you want to know more about me the checkout http://www.colinwiseman.co.uk.
Dirk
Posted: Monday, October 13, 2008 11:01:55 AM

Rank: Umbracoholic

Joined: 9/27/2007
Posts: 1,123
Location: Belgium
Hi,

Bit strange. Don't have an umbraco install atm, but if you don't worry to get your hands dirty, I would recommend to download latest changeset and debug the whole thing.

Or, as a last test, unpublish the /somethingdifferent.aspx page to check whether the page is now correctly 'resolved'. It will either be a config setting (that I'm not aware of...) or it's an issue.

requesthandler.cs should be a good starting point for debugging.

Hope that helps.

Regards,
/Dirk




level 1 & 2 certified - umbraco MVP 2008/2009 - umbraco blog at netaddicts.be - working on an integrated forum4umbraco
colin.wiseman
Posted: Monday, October 13, 2008 11:12:02 AM

Rank: Enthusiast

Joined: 10/10/2008
Posts: 42
Location: Scotland
Thanks Dirk,

I would love to do that, but I don't have the time unfortunately. But your second solution worked. I deleted the page /somethingdifferent.aspx and recreated it. The similar named pages now work properly, so it looks like the engine finds the first instance of the page name, and stops.

However that said, the /business/default.aspx and /education/default.aspx still resolve to the wrong page, it resolves to the /default.aspx.

Rats, i may just have to download the whole change set.

http://you.arenot.me but if you want to know more about me the checkout http://www.colinwiseman.co.uk.
colin.wiseman
Posted: Monday, October 13, 2008 11:22:41 AM

Rank: Enthusiast

Joined: 10/10/2008
Posts: 42
Location: Scotland
Does it make a difference that I am currently using v3.0.3?

http://you.arenot.me but if you want to know more about me the checkout http://www.colinwiseman.co.uk.
colin.wiseman
Posted: Monday, October 13, 2008 3:07:54 PM

Rank: Enthusiast

Joined: 10/10/2008
Posts: 42
Location: Scotland
Found the problem, and the solution.

I downloaded the source code for umbraco and hooked it all up...after some fiddling.

The following code lines in a file called requestHandler.cs:

Code:
if (GlobalSettings.HideTopLevelNodeFromPath && requestRawUrl.Length == 2)
{
            _tempQuery += " | " + pageXPathQueryStart + "/node [" + _urlName + " = \"" + requestRawUrl[1].Replace(".aspx", "").ToLower() + "\"]";

}


add in an extra clause to the query of the database. This clause is always true (due to my naming of files) and thus brings out the very first page everytime, and due to the order they are in - numerical by the page id - the default.aspx of the root directory of the site is always top of the list, and thus gets displayed. By removing this extra clause I get the desired effect.

Phew!

http://you.arenot.me but if you want to know more about me the checkout http://www.colinwiseman.co.uk.
Dirk
Posted: Monday, October 13, 2008 3:11:28 PM

Rank: Umbracoholic

Joined: 9/27/2007
Posts: 1,123
Location: Belgium
Great you've found a solution.

If it's true what you say, I would recommend adding this issue to Codeplex, as this is something other people might run into in the end. Do you mind adding it?

Regards,
/Dirk


level 1 & 2 certified - umbraco MVP 2008/2009 - umbraco blog at netaddicts.be - working on an integrated forum4umbraco
colin.wiseman
Posted: Monday, October 13, 2008 3:21:24 PM

Rank: Enthusiast

Joined: 10/10/2008
Posts: 42
Location: Scotland
I wouldn't really know how to add it. I am very much new to the open source style coding world. I have always done in house propriatry coding and never used codeplex the way its supposed to be used.

Can you maybe point me in the right direction of where to start?

http://you.arenot.me but if you want to know more about me the checkout http://www.colinwiseman.co.uk.
colin.wiseman
Posted: Monday, October 13, 2008 4:03:17 PM

Rank: Enthusiast

Joined: 10/10/2008
Posts: 42
Location: Scotland
Ok actually am getting new errors in the website - can't edit templates and documents are crashing!

This won't be because of the code change per say, but the versions that the website code is expecting compared to the source code i downloaded?

http://you.arenot.me but if you want to know more about me the checkout http://www.colinwiseman.co.uk.
colin.wiseman
Posted: Monday, October 13, 2008 5:20:36 PM

Rank: Enthusiast

Joined: 10/10/2008
Posts: 42
Location: Scotland
Sorted.

I had set IIS to throw everything through iis_aspnet.dll and this is was causing me some problems. All sorted, all working! Nice!

http://you.arenot.me but if you want to know more about me the checkout http://www.colinwiseman.co.uk.
colin.wiseman
Posted: Monday, October 13, 2008 5:24:59 PM

Rank: Enthusiast

Joined: 10/10/2008
Posts: 42
Location: Scotland
I meant aspnet_isapi.dll

http://you.arenot.me but if you want to know more about me the checkout http://www.colinwiseman.co.uk.
Dirk
Posted: Monday, October 13, 2008 5:58:50 PM

Rank: Umbracoholic

Joined: 9/27/2007
Posts: 1,123
Location: Belgium
colin.wiseman wrote:
I wouldn't really know how to add it. I am very much new to the open source style coding world. I have always done in house propriatry coding and never used codeplex the way its supposed to be used.

Can you maybe point me in the right direction of where to start?


Just point browser to http://www.codeplex.com/umbraco and select the issuetracker tab.
You'll have to login first to create new items. Or, I you don't have a login, create one first.

It would be really great if you could do that. Anything that helps the umbraco team build better software is much appreciated. In the end, everybody wins.

Hope that helps.

Regards,
/Dirk




level 1 & 2 certified - umbraco MVP 2008/2009 - umbraco blog at netaddicts.be - working on an integrated forum4umbraco
Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.