Organising content

I wrote once before a long tedious article about how a collection of web content could be organized in a particular way to make it easier to generate good URLs, and to keep the object model simple. I think most of what I said will still apply to this CMS quite well.

If I store content in Subversion, then I'm tied to its file system model. That means I can't quite use my old idea of unifying files and directories, but I can get the same effect (directories with content) by having a special filename like index.html for content that is tied to a URL ending in the parent directory's name.

Actually, I think I'll use _index.html instead. It'll be cleaner if I have a standard way of naming files that are specially handled by the CMS, and sticking an underscore on the front seems reasonable. I'll keep the file extension (.html) because there might be multiple index files in different formats or different languages, with content negotiation determining which one is served.

I can use the same underscore trick for template directories. That way you can locally override templates just by adding a _templates directory somewhere.

There should probably be some kind of escape mechanism, so lets say that files are only ‘special’ for the CMS if they start with exactly one underscore. Files with more than one underscore at the start of their name have one of them stripped off whenever the name is used for generating output files or URLs.

< Track path changes and file identity | How to store file data in working copies >