In trade-offs between simplicity and flexibility, Mango tends to favour the latter at the expense of the former. Mango was conceived by a developer keen to exchange one-size-pretty-much-fits-all-with-a-bit-of-hackery WordPress for something simpler. Blogging, after all, should be about writing posts, not dealing with the complexities of a CMS.
Mango enforces several conventions. The most important is that of file naming. File names are used by Mango as slugs. Take this posts directory, for example:
Three URLs will be "active" in this case:
This simple mapping between file names and URLs ensures that a database table is not required.
Note that files in the posts directory do not require a particular extension – in fact, they don't require an extension at all.
Mango accommodates short URLs thanks to a simple naming convention: (alias)=>(slug).text
Six URLs will be "active" in this case:
- http://mysite.com/1/ => http://mysite.com/my-first-post/
- http://mysite.com/2/ => http://mysite.com/my-second-post/
- http://mysite.com/3/ => http://mysite.com/my-third-post/
(For those with an interest in SEO, 302 redirects are used to redirect the browser from the short URLs to the full equivalents.)
There's no requirement that a post's alias must be a numeric index; any text will do. This means that it's possible to do the following:
Mango accommodates zero padding of aliases (for those running operating systems that think that 10 comes before 2). For example:
Crucially, /1/ will map to /my-first-post/ but /01/ will not.
There's no limit on the number of zeroes that may precede an alias: 000001=>my-first-post.text will still be accessible via /my-first-post/ and /1/ only.
Word of caution
When using aliases be aware that there's nothing in place to ensure the uniqueness of either the alias or the slug: files named 1=>apples.text and 1=>oranges.text may both reside happily in the same directory. Mango handles such conflicts gracefully by displaying the content of the first file matched.