Peter
Peter

Reputation: 769

How to add metadata in Github-Flavoured-Markdown?

I would like to add metadata information to my markdown files like author, tags, ... . Is it possible to add metadata to a github-flavoured-markdown file, like you can do with multimarkdown?

Upvotes: 7

Views: 5761

Answers (3)

catwith
catwith

Reputation: 1275

Use yaml like metadata with --- on the top of your markdown:

---
title: Blogging Like a Boss
author: me
---

which will render like a table:

at the top of your document.

Ref: https://github.blog/2013-09-27-viewing-yaml-metadata-in-your-documents/

Upvotes: 2

Rowe Morehouse
Rowe Morehouse

Reputation: 4585

For GFM, add your metadata inside comments, like this:

[//]: # (Title: Marketing Meeting Notes)
[//]: # (Author: Alan Smithee)
[//]: # (Attendees: Larry, Curly, Moe)
[//]: # (Tags: #training #onboarding)
[//]: # (Date: June 18, 2015)

… so your metadata won't render in the browser or other markdown readers. This solution emulates multimarkdown's support for .yaml front matter metadata.

See this answer about comments in .md:

Comments in Markdown

Upvotes: 0

Abhey Rana
Abhey Rana

Reputation: 51

How you add metadata to a markdown file will depend on how that file is rendered on web. If you are using GitHub pages to turn that markdown into HTML for your website then the GitHub support is likely to offer you some advice.

However if you're not using GitHub Pages, you'll need to discuss this with whatever tool or renderer you're using to turn your markdown into HTML.

For example in my case I was using GitHub pages to turn that markdown into HTML. As I was using one of their builtin themes they asked me to modify the content of the layout file that I was inheriting in order to add more metadata items to it.

Upvotes: 1

Related Questions