7

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?

Peter
  • 769
  • 1
  • 9
  • 23
  • 2
    Have you tried it? IIRC, GitHub will simply display the metadata as a table at the beginning of the document. – Waylan Mar 22 '17 at 20:05

3 Answers3

2

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/

abernier
  • 27,030
  • 20
  • 83
  • 114
catwith
  • 875
  • 10
  • 13
  • ok, reading the 2013 linked article, I know understand, that the rendered "table" is the intended way to render those metadata – abernier Nov 30 '22 at 18:13
1

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.

Abhey Rana
  • 51
  • 4
0

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

Rowe Morehouse
  • 4,451
  • 3
  • 28
  • 28