we are working on a new project which is a website that contains many company details over different categories. You have bars, restaurants, shops, juwelers, garages, and so on.
For the content structure we would like to be able that the company is reached by
So we need to create document types for the category and for the company nodes.
Where the company node has a link to the categories it belongs to by having a multi node treepicker.
But how will be setting up this content structure? So we start with the home node and then? We can't just putting categories and company all directly under the home node?
This provides a clean way to manage the categories, then you can create a multinode picker with the categories node set as the default and use that to pick the categories.
As for the URL's, the easiest way that I have found to handle this, is through a URL rewrite. For example, you could use something like the following:
Please note that this is a pretty broad rewrite and used just for an example. You would want to tighten up the Regex and modify to fit your needs. However, this would rewrite the URL to take the business name and load that businesses page. Another way to handle it could be through a query string:
Where business-details is the URL alias to a page that would take the business name a populate the details accordingly.
Edited, since I saw in the second post that you were asking about the category URLs as well. To make the process as simple as possible, you can adjust the permissions for the categories to allow the creation of categories under a categories node, which would allow the nesting that you are talking about. For example:
Categories
-Restaurant
- Italian Restaurant
- Chinese Restaurant
As for displaying the restaurants for a given category. You can use the second URL rewrite example to pass the category name to a page that will
Take the category name and retrieve the category ID
Use the category ID to retrieve all restaurants where CategoryProp (multinode tree picker) contains the ID.
I would handle businesses much the same way. Have a business container node that would accept only the business doctype.
Although the urls you mention need to be handled in some way, it is not the most important part of defining the structure. It is something that can be handled and it can be done in several ways in Umbraco.
First, ask yourselves what is needed for the Content Managers to edit the content.
What do they need? What are they allowed to access/edit? etc.
This will lead you to a suitable structure.
After that, you can use
IIS url rewrite rules (if rewriting can be done by convention) or
UrlProviders and ContentFinders (if application logic is needed to return correct content)
So, try to setup a manageable structure.
As Jason Vicker already suggested, in general you can go for Categories and Companies as container doctypes, containing Category and Company doctypes as child nodes.
Refine the structure in case you need more control.
Eg. if content editors are allowed to edit content only for their own company, make sure the structure is setup in a away it is easy to configure access to "their" nodes...
Home
Contact
About
Categories
Restaurant
Italian Restaurant
French Restaurant
Cinema
Companies
Company 1
Company 2
Where under categories you can add categories or subcategories, eg where Restaurant has no parent assigned and where Italian Restaurant has a property Parent which is the Restaurant category.
Then for Companies I can define companies and assign categories to it using a multi node picker.
Now all of this is working fine.
The nodes Categories and Companies have no template assigned so when you go to this url you get a 404.
But when I setup url rewriting for the categories, this will have also an effect for the about and contact pages. How can I prevent this so that the url rewriting only gets involved for the categories?
Umbraco content structure advice
Hi all,
we are working on a new project which is a website that contains many company details over different categories. You have bars, restaurants, shops, juwelers, garages, and so on.
For the content structure we would like to be able that the company is reached by
http://www.example.com/company-name/
but it can also be accessed by using the category:
http://www.example.com/restaurant/company-name/
or when it belongs to multiple categories:
http://www.example.com/lounge-bar/company-name/
So we need to create document types for the category and for the company nodes.
Where the company node has a link to the categories it belongs to by having a multi node treepicker.
But how will be setting up this content structure? So we start with the home node and then? We can't just putting categories and company all directly under the home node?
Or is it better for just allowing
http://www.example.com/company-name/
as the link to the company details?Any advice?
/Michaël
Also we start with primary categories but these can also have subcategories so it is possible to have:
http://www.example.com/restaurant/
as primary category and then have
http://www.example.com/italian-restaurant/
http://www.example.com/chinese-restaurant/
as subcategories of restaurant but you see we don't want to put the restaurant in the url so this also need to be put under the home node then or... ?
/Michaël
The way that I usually handle this situation is to create a category doctype with a container doctype that houses these categories. For example:
Categories (doctype container - permissions allow doctype category_
This provides a clean way to manage the categories, then you can create a multinode picker with the categories node set as the default and use that to pick the categories.
As for the URL's, the easiest way that I have found to handle this, is through a URL rewrite. For example, you could use something like the following:
Please note that this is a pretty broad rewrite and used just for an example. You would want to tighten up the Regex and modify to fit your needs. However, this would rewrite the URL to take the business name and load that businesses page. Another way to handle it could be through a query string:
Where business-details is the URL alias to a page that would take the business name a populate the details accordingly.
Edited, since I saw in the second post that you were asking about the category URLs as well. To make the process as simple as possible, you can adjust the permissions for the categories to allow the creation of categories under a categories node, which would allow the nesting that you are talking about. For example:
As for displaying the restaurants for a given category. You can use the second URL rewrite example to pass the category name to a page that will
I would handle businesses much the same way. Have a business container node that would accept only the business doctype.
Cheers, -Jason
Hi Michaël,
Although the urls you mention need to be handled in some way, it is not the most important part of defining the structure. It is something that can be handled and it can be done in several ways in Umbraco.
First, ask yourselves what is needed for the Content Managers to edit the content. What do they need? What are they allowed to access/edit? etc.
This will lead you to a suitable structure. After that, you can use
IIS url rewrite rules (if rewriting can be done by convention) or
UrlProviders and ContentFinders (if application logic is needed to return correct content)
So, try to setup a manageable structure.
As Jason Vicker already suggested, in general you can go for Categories and Companies as container doctypes, containing Category and Company doctypes as child nodes.
Refine the structure in case you need more control. Eg. if content editors are allowed to edit content only for their own company, make sure the structure is setup in a away it is easy to configure access to "their" nodes...
Hi,
sorry for the late response!
I have now setup umbraco to be used like:
Where under categories you can add categories or subcategories, eg where
Restaurant
has no parent assigned and whereItalian Restaurant
has a propertyParent
which is theRestaurant
category.Then for
Companies
I can define companies and assign categories to it using a multi node picker.Now all of this is working fine.
The nodes
Categories
andCompanies
have no template assigned so when you go to this url you get a 404.But now I need to setup the url rewriting.
The following urls are valid:
http://www.example.com/restaurant/
http://www.example.com/italian-restaurant/
http://www.example.com/italian-restaurant/company-1/
http://www.example.com/french-restaurant/company-1/
http://www.example.com/about/
http://www.example.com/contact/
But when I setup url rewriting for the categories, this will have also an effect for the
about
andcontact
pages. How can I prevent this so that the url rewriting only gets involved for the categories?/Michaël
For the parts that are harder to write with url rewrites, you could use multiple ContentFinders.
One ContenFinder that searches for the nodes in the root of the structure. If that one doesn't find a matching node, just return null.
The next ContentFinder will try to find one. This might be a ContenFinder that searches in the sub nodes of your Categories node.
The order in which you add ContentFinders will help finding the right node.
Hope this helps you further!
Hi Micha,
thanks for the intel!
I managed to get it working by using 2 contentfinders and 2 urlproviders. One for the categories and one for the companies.
Have a nice day!
/Michaël
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.