Setting unique URL names for nested documents - umbraco

My content tree goes somewhat like this
Articles
2016
1
Article 1
2
...
2017
1
Article 1
2
...
Is there any way to make Umbraco pick unique URL names for "article 1"?
As for no it gives me "/articles/2016/1/article-1" and "/articles/2017/1/article-1" which by itself is not wrong.
But I would rather have it do like "/articles/2016/1/article-1" and "/articles/2017/1/article-1-1".
The reason for this, is that I'm currently suppressing the year and month in the URL's, but would like to maintain the tree structure in the backoffice.

Nope, not out of the box. By default, the Umbraco UI will ensure unique naming of pages AT THE SAME LEVEL.
So if you already have a page called "Page 1" and try to add one of the same name at the same level, Umbraco will automatically rename it "Page 1 (1)".
It doesn't check the rest of the site though, just the level that you're adding the content on.
To accomplish what you're after, you'd be looking at some kind of event handler on the content service or something similar, and check there for other nodes with the same name at any level.

Related

Grouping and querying content in Umbraco

I am attempting to set up a shared content repository in Umbraco 7. Ideally I would like something like:
ParentGroup
--SubGroup
----contentItem
I would like this structure and then I would like sub sites to be able to pick and choose which content they use, whilst keeping the grouping. I've looked at the multi node tree picker and this looks promising.
I am struggling however with how to organise the content into groups, a group would really be a text label, do I just create a content type without a template for this or is there a better way.
I think creating a document type without a template is the way to go. Every content item in the content tree is defined by it's documenttype and it's perfectly reasonable that not every content item translates directly to a page, thus not having a template.

Umbraco Same Url Render Page Sequence

I'm new to umbraco and using umbraco 6 latest version... Actually this is a silly mistake but makes me curious..
I've two content, let's say item a and item b.. This two item will be published alternately. so it can be access via "mysite/item_active"..
Today -> item a -> change name to item_active -> save publish -> change yesterday item active to item_b..
But somehow I forgot to use save publish yesterday.. And only click save that make the url of the content is not being updated..
Then how umbraco will choose with item to render (both item now have "mysite/item_active" url)?
The day I asked you is holiday until monday.. And I don't have access this site (because this internal company site) from home..
Are based on node? the smaller node is the one being render or the latest publish item will be rendered?
Umbraco won't allow you to save and publish two items with the same URL / node name (on the same tree level). It will automatically add version number e.g. (1) for the next node with the same name and then, friendly URL will become /mysite/item-active-1 in your case.
I tested this scenario, and Umbraco returns this information when you're trying to publish item with the same name as existing one:
So, in theory - we have two items published, but only one is still in the XML (IPublishedContent) cache, from which Umbraco is taking content first. Second item won't be visible until we will change the URLs / names to be different or perform publish on first item and then scenario described at the beggining will be applied.
Maybe it's worth to consider having it as a same page and just swaping the templates on which you can render particular properties values? Or having a content picker or something else to determine which version of the site should be marked as active and used?

Where should I put data like testimonials and addresses in Umbraco?

I am fairly new to Umbraco and I am wondering where I should put pieces of random data.
I have a lot of experience with Sitecore, used it for several years, I am certified etc etc. But now I have to build something with Umbraco. At a first glance Umbraco looks inferior to Sitecore in every way, but I might be wrong about that.
So what I am wondering is, where should I put non-browsable pieces of data that are visible on several places throughout the website? I'd like to create data items in Umbraco for things like Testimonials, Offices? I'd like to have a centralized place in Umbraco where they can be maintained and reference them from a page node. But the way it looks now is that everything has to be on the page node. Which is sort ok, for your average family webpage.
Could someone please shed some light on this?
You could create another node under the man content and call it site settings and store them there that way all pages under the home page are just visible pages on the front end and all data nodes are in a separate area.
There is one property in umbraco that you can add to document types and name it "umbracoNaviHide" (for alias, the name can be anything). This allows wires in automatically to the .IsVisible() method.
var children = Model.Content.Children.Where(x => x.IsVisible());
I find this situation to be very frequent, think of slideshows. When I make an Umbraco website, under my root node I normalle havea Slideshow document type (that contains slides) and I programmatically traverse those to build the slideshow on the home page for example. This Slideshow document has that "umbracoNaviHide" property and I skip it from my menus either using the .IsVisible() method or by manually skipping specific document types.
var menuItems = Model.Content.Children.Where(x => x.DocumentTypeAlias != "Slideshow" && x.DocumentTypeAlias != "Search");
On the other hand, if you are looking for "labels", you can look at "Dictionnary" items under the "Settings" tab.
To directly answer your questions, I reccomend putting non-browsable pieces of data as children of the relevant browsable content node. (But there are other valid ways to do this, it really is up to you and what's best for your content editors.)
Hope this helps.

Maintain parameter info in the request path for all pages instead of the subdomain

I seek some guidedence here ... ( I'm not sure if this is the best title )
At the moment I prepend a "server name" to the url like this:
server10.example.com
This works fine, except that I need to handle all the subdomains on the IIS and I'm not sure google are happy about jumping around from sub to sub to sub, when it seems the links to the other servers.
I'm kind a hoping for a nice way to archive this wioth asp.net mvc.
Most pages are related to a "server" ... there are however a few info pages, contact, home that dont really need a valid "server" name ... but could just be "na" for not available, but the name need to be maintained, if there is already a selected server, when a user are keeps browsing the site. This needs to be as transparent as possible when I need to create the links to the diffenrent pages.
I could extend the Html Action() extensien to automatically add the selected "server" from the previusly request to the page.
In the format:
/{serverParameter}/{controller}/{action}/{parameterInfo}
And if no server is selected, just add "na" as the {server} placeholder.
I'm not sure if more information is needed, but please let me know if ...
I tired of extracting the selected server from the domain part and the other way also seems better, I just can't think of a good way to structure this ...
Updated
90% of all the pages are about a server that the user select at some point. Could be server10, server9, server20 ... just a name. I want to maintain that information across all pages, after the users has selected it or else I just want it to be f.ex: "empty".
I mostly looking for an easy way of doing this or an alternative ... atm I'm prepending the serverParamter to the url so it ends up being: "serverParameter.example.com".
I want to end up with something like
http://example.com/{server}/{controller}/{action}
instread of
http://{server}.example.com/{controller}/{action}
If I understand your question correctly, you just wish to group different collections of content together above the controller/action level. If that's the case, have you considered using ASP.NET MVC areas?
Just right-click on your project, and choose Add -> Area.... Give it a name (what you're calling "server"), and then you can add content, your own controllers, actions, etc. Under this area. You will automatically be able to access it via /AreaName/Controller/Action/etc.
I went with the already impemented routing in ASP.NET MVC.
{server}/{controller}/{action}
When creating the links it takes the set value for {server} and places the value when generating URL's, so I only need to supply controller and action in the #Html.Action helper method ... this could not have been more easy.
I'm not sure why I did not think about this. One just gotta love routing.

How to structure content in Ruby (RoR) app?

I am in the process of building a super simple CMS to handle smaller "static" page type projects (e.g. - small sites for friends). I have different "page types" that I would like to add. I built something similar in Coldfusion previously. Looked something like this:
table content_type:
content_type_code varchar(10)
content_type_name
table content:
content_id
content_type_code varchar(10)
content_name
content_desc
content_url
I would create a content type called "blog" or "photo" and each time a content was added, it'd get assigned the content_type_code. Then in /blog/ I'd query for all content that had a content_type_code of "blog".
Now that I'm using Ruby/RoR I am trying to think about things differently. I was thinking a better way might be to use nested pages with awesome_nested_set (https://github.com/collectiveidea/awesome_nested_set). But I'm not sure if that's the best solution.
Then I could create a page called "blog" and add to that many pages. So essentially the top level would take place of the "content_type" from my previous example.
Can someone steer me in the right direction on what the best method would be? I'm a newb looking for a kick in the right direction.
EDIT
I should add that the only real thing that I would change between the different "types" of content would be the layout and where they are displayed ("photo" content at /photos/, "blog" content at /blog/).
I try to recap:
You want to build a CMS
Your CMS manages a single web site
A web site is made of content
There are differenti type of contents, and I am assuming every type of content has its own behaviour
Contents are organized in a tree
Here is the plan I suggest you:
Create the Content resource; use the scaffold to have something already working, adding few field (title and body in example)
Add validations to your new model
Write a couple of unit tests against your validation (quite useless, just to see how it works)
Install awesome_nested_set and manage to make it working with your model
Work on the UI to make it quite easy to create new content, move content around, edit a single content
Now its time to implement the content types; STI is the Rails way, but I have to warn you it can be really hard. I suggest you to reiterate 1, 2, 3, 5 to create new models for Photo and BlogPost
Once you will be there, you will have hundreds of ideas to implement. Have fun :)
Instead of using content_type I would rather let the user choose a model on a selection page, like "photo" or "blog" and load an editing page based on that selection. So the user wants a new 'blog'-entry they get redirected to blog/new or 'photo' for photo/new. It's the easiest way to go in terms of usability and your controlling backend and you don't have redundant data (for example an empty photo url which is not necessary in a blog-type) in your database.

Resources