1

I have a DocumentType called Blogs. It has a child DocumentType called Blog.

I create a content of type Blog.

The name of that content is "Coding is great".

I can now navigate to that blog with the URL:

www.example.com/coding-is-great

I want it to be:

www.example.com/blogs/coding-is-great

How can I prefix URLs with something like the above?

-----Edited

In response to wingyip answer. I do already have a structure like this:

enter image description here

But the urls do not generate as you'd expect.

Jimmyt1988
  • 20,466
  • 41
  • 133
  • 233
  • 1
    Hmmm... the structure above is problematic and non standard. You could make it work but it would involve mucking around. The root of your website is usually a parent node under which all of the other pages like About, Contact etc are nested. – wingyip Oct 05 '15 at 23:22
  • Where is the blogs node going as well? – wingyip Oct 05 '15 at 23:35

2 Answers2

4

I disagree with the approach taken by the other two - To achieve what the op requires is simpler by rearranging content.

Its very important to note, and is a common issue with people starting out in Umbraco, that the hierarchy of your document types has nothing to do with the structure/hierarchy of your website.

The structure of your website is dictated by your Content tree.

So if you had a parent node called Blogs which had a child node of Coding is great then you wouldn't have to do any mucking around - the url would be as you require it.

Home
   Blogs
      Coding is great

In your document types, is there any reason that Blog is a child of Blogs. The only valid reason to do this is if Blog needs to inherit properties from Blogs otherwise Blog should not be nested.

If I was doing this I may have a document type called Blog with an associated template that would list my Blog items.

Does that clear anything up?

wingyip
  • 3,465
  • 2
  • 34
  • 52
  • How is rearranging the content structure of the site simpler than updating one setting in the web.config file? And there may be legitimate reasons to have Blogs as the root node instead of a Home node. However, other than that, your answer is a good and standard solution. – Robert Foster Oct 02 '15 at 14:53
  • I agree yes there may be a legitimate reason for using umbracoHideTopLevelNodeFromPath. However, the wording of the of the post makes me feel that there could be a misunderstanding about the role of document types and their relation to content. I could be wrong... wouldn't be the first time... ;) – wingyip Oct 02 '15 at 15:22
  • I do not want a Home node for my client to use... This will confuse them, as the home page is nothing to do with the Blogs page... or blogs. – Jimmyt1988 Oct 05 '15 at 17:30
  • The solution was to add one root node, I made a Document Type called "Root" and just made a node called "Website"... Then it seems if i add things underneath that, the urls start working again. `Website/News/News-item` – Jimmyt1988 Oct 06 '15 at 08:33
  • Marvellous! Its strange, the first Umbraco site I built was in 2009 and I made exactly the same mistake ie my Home / Root site node was at the same level as all of my internal web pages. I made things work but had no end of problems and this was all in xslt. – wingyip Oct 06 '15 at 12:48
0

Create in TextPage (Settings=>Document Types=>Master) new property umbracoUrlAlias and enter new alias for content How create url alias

ARZi
  • 1
  • 1
  • That won't necessarily help - you need to change an appSetting in your web.config file: Change `umbracoHideTopLevelNodeFromPath` from `true` to `false` and re-publish your content. – Robert Foster Oct 02 '15 at 02:43