cmillr / simple-md

A very-simple website platform based on PHP and Markdown.
1 stars 0 forks source link

Page Titles #3

Open cmillr opened 12 years ago

cmillr commented 12 years ago

There's got to be a good way to assign a page title to a markdown document. Here are the possibilities I've thought about so far:

My first thought was that the system could read the first heading in the text document and make that heading into the page title. This has simplicity and ease-of-use going for it, in addition to the fact that all existing Markdown documents are already compatible with this scheme.

Another approach would be for each markdown document to open with a JSON object containing the page title and other metadata about the page (specifically, the page title.) This JSON element would (obviously) be stripped from the text before the document is parsed as markdown. This would allow the user to have much finer-grained control over this element. This also favors extensibility and future-proofing, because we could easily integrate arbitrary metadata field rendering into the template renderer. This broadly opens up the possibilities for the future.

Both of these approaches have major strengths and weaknesses! The ideal approach would be for both of these methods to work; the first by default, and the second would be triggered when the content reader detects leading JSON data.