简体   繁体   中英

Create Folder Structure to Organize Content in Umbraco

I have many pages in the content section of Umbraco but some of the pages I would like to organize for departmental reference not necessarily for hierarchical site reference. For example, my pages might be A, B, C, D ... Z on the website but on the backend we have various teams that need their content grouped together. ie Team 1 folder has AG in it. Team 2 folder has HQ. Team 3 has RZ in it. How can this be achieved so instead of seeing all the content on the root of the content page I only see these 3 team folders?

You have to be carefull in achieving this. When you create new nodes under your Home root node, eg new pages or folders, they are referenced with an url.

So If you have a page called A , this will be accessed using the url http://www.example.com/a . When you create folders to organize pages and you place page A under HQ , then your page will now be accessed by http://www.example.com/hq/a .

After that you can use url rewriting rules to avaid these folders indications in your url but that will be messed up if you have many pages.

I will suggest if you don't want to see these folder indications in your url, to just add all the nodes under your Home node and using Permission to allow/disallow departments to the nodes.

If you don't care about the folder indications in your url, let me know then I will edit this answer with the solution to achieve this.

EDIT

How to add folder structure in your content nodes.

Step 1

Create a new Document Type called Content Folder .

  1. Go to Settings > Document Types > click on the 3 dots > Create .
  2. Give it the name Content Folder .
  3. As icon select the folder icon
  4. Add a new property Redirect with alias umbracoRedirect with type Content Picker
  5. Save changes

The builtin property umbracoRedirect is used to redirect one node to another using its id. So for each folder set this property to the first child page.

Step 2

Allow your child node types in this folder.

  1. Go to the structure tab of your Content Folder property
  2. Check the child types that you want to allow under this folder
  3. Save changes

Step 3

Allow this folder under your root Home node.

  1. Go to the structure tab of your Home root property
  2. Check the ContentFolder type to allow as a child
  3. Save changes

Step 4

Add you folder structure and add pages.

  1. Go to your content
  2. Add a new folder under your root node of type Content Folder
  3. Give it the name HQ
  4. Add a new page called A that's allowed under your folder
  5. In your HQ set the Redirect property to your first A page
  6. Do this for all your folders and pages
  7. Save changes and publish

And thats it!

Another way of doing this is with a custom URL Provider and Content Finder. This is where you create a new provider for working out the URL of the pages on your site, overriding the default folder structure.

You can add your own logic out strip out folders from the URLS, so /folder/a/content could become /folder/content. Obviously you'd need to be careful that the other folders don't contain items with the same names, or you may get the wrong content returned.

The advantage of a URL Provider is that whenever you call the Umbraco methods to get the URL of a content item, you'll ALWAYS get the custom URL.

The content finder is a way for the site to match the modified URLs back to the original content. You'll need both for it to work.

Here is a link to an in depth article about using these two in conjunction in an Umbraco site.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM