Markdown Front Matter For Metadata

5 years ago 24

Continuing the story of replacing Windows Live Writer with some custom tools... In addition to image uploads and code formatting, I also needed the ability to: Specify the date and time for the post to turn publicly visible (future posting). Save the database-generated ID for a post so the post can be updated in the future. Save the server-generated URL for a post to easily preview the post. All of this metadata was information I wanted to track for each markdown file, but I didn't want to keep the metadata outside of the markdown file in a separate store, because synchronization only adds complexity. I was looking for a way to embed metadata into the markdown file itself, but the CommonMark specification doesn't provide for metadata. Fortunately, I found a number of tools and libraries support YAML front matter in markdown. Front matter is easy to write, easy to parse, and a good solution if you need to keep metadata associated with your markdown with you markdown. The picture below shows a post after publication, so the tools have added an ID and a URL. I add the date to publish and the title.


View Entire Post

Read Entire Article