Clone wiki

Mango / PostMetadata

Post Metadata

Posts may contain metadata. This is simply text at the top of the file. Here's an example:

date: 13 April 2010
time: 10:46pm
tags: blogging, Mango, woot!

My First Post

Welcome to Mango. We hope you enjoy using it as much as we do!

This metadata is parsed and made accessible to the Django post template in the form of a dictionary named meta. Each of the following keys may appear in meta: datetime, date, time, tags, title (datetime is a datetime object, date and time are strings, tags is a list).

meta['title'] is extracted from the body of the post (in this case it would be 'My First Post'). The parser removes the heading from the body text. This allows the template author to insert markup between heading and body if required. The meta['title'] string may of course also be used in the page's <title>.