30 votes

AutoFolders

SUMMARY

This free package auto creates folder structures for new pages. The folder structures can be date based (yyyy -> MM -> dd, yy -> MMM, etc) or alpha character based (a-z).

Different folder structures can be created per document type, along with custom structures to be defined by developers via config/autofolders.config.

Example: http://our.umbraco.org/media/wiki/5535/633850116316060000_AutoFolders-Possible-Configurations.png

Folder structures can be ignored on the front-end by using the installed autofolders.library:NiceUrl() xslt extension alongside the AutoFolders 404 handler.

This package is ideal for anyone who creates blog or news items on a regular basis.

UPDATE 16/12/11: Released v2.0.3 - Updated to use new schema and work with 4.5 + this version WILL NOT work with the old schema, for older sites, use 2.0.2 or earlier! Adds property folder provider courtesy of Drew Brigham. Fixes several small bugs.

UPDATE 05/012/09: Released v2.0.2 - Bug fix: Link To Document bug.

UPDATE 05/012/09: Released v2.0.1 - Bug fix: Removed creation of MinValue datefolder.

UPDATE 28/09/09: Released v2.0 - New Feature: Now reorganises existing content.

UPDATE 28/09/09: Released v1.3 - New Feature: RootFolder - the ability to restrict the parent folders applicable via xslt.

UPDATE 28/09/09: Released v1.2 - Bug fix release..

UPDATE 01/09/09: Released v1.1 - Now includes AlphaFolderProvider and supports truncated URL's on the front-end.

 

THE DETAIL

The package is controlled from a settings file created in config/autofolders.config. This file allows you to specify what doctypes are processed by AutoFolders.

Settings Screenshot - http://our.umbraco.org/media/wiki/5535/633902467497320000_AutoFolders1-3-Settings.png

N.B. Remember to change the docTypes in the setting file. The demo values are for doctypes 'Standard' and 'DateFolder'.

Each doctype can specify it's own FolderProvider. Each FolderProvider makes its own decision on what and how many sub folders to create. The FolderProviders are loaded at runtime (similarly to xslt extensions) so you can add your own providers as required.

The above settings file will configure AutoFolders for two DocTypes; NewsItem and Standard, these are configured to use the in-built DateFolder and Alphafolder folderproviders respectfully.

The DateFolder provider will create sub folders of type ‘DateFolder’ in the format yyyy -> MM -> dd. If you removed the DayFormat line then the DateFolder provider would only create yyyy -> MM folders. The MonthFormat and YearFormat are mandatory.

 

TRUNCATED URLS

The DateFolder provider also has a TruncatedFolderUrl specified. In this example, it will intercept all requests to www.domain.com/folder-1/folder-2/newsitems/item1.aspx and respond with the actual page, e.g. www.domain.com/folder-1/folder-2/newsitems/2009/08/04/item1.aspx.

The page redirect is a server redirect, intercepted via a NotFoundHandler (see config/404handlers.config).

You can output the new (faked) NiceUrl by using the xslt extension autofolders.library:NiceUrl(nodeId). This will produce the truncated Url. This method is safe to use for all pages in your site as it defaults to umbraco.library:NiceUrl if the AutoFolders settings don’t deal with that specific DocType.

 

POSSIBLE CONFIGURATIONS

This version ships with two providers, DateFolderProvider and AlphaFolderProvider. The settings file can be edited to produce the following scenarios (and more).

http://our.umbraco.org/media/wiki/5535/633850116316060000_AutoFolders-Possible-Configurations.png

 

BUGS & ISSUES

Please raise any issues on the forum below. All feedback is welcome and appreciated.

The source code is now available below.

 

-----------------------------------------------------------------------------

REMEMBER TO VOTE FOR THE PACKAGE IF YOU LIKE IT

-----------------------------------------------------------------------------

Screenshots

Package owner

Chris Koiak

Chris Koiak

Chris has 2626 karma points

Package Compatibility

This package is compatible with the following versions as reported by community members who have downloaded this package:
Untested or doesn't work on Umbraco Cloud
Version 8.18.x (untested)

You must login before you can report on package compatibility.

Previously reported to work on versions:

Package Information

  • Package owner: Chris Koiak
  • Contributors: Tim
  • Created: 02/08/2009
  • Current version 2.0.3
  • License MIT
  • Downloads on Our: 5.3K

External resources