Use Custom Front Matter

Can someone explain it?

image

I’m guessing you are already doing this and maybe think it is something more than it is?

In the front matter you can make any custom variable that you want - such as yashumittal : I am yashumittal

and then you can get that in the content of that page by doing {{page.yashumittal}}

Jekyll itself has a couple of predefined ones - everything else is a custom one. I think date, permalink and title are some of the built in ones.

Hmm…

Can you share some real use-case?

sure, on some pages I put output: false and then I check it on say a sitemap page and check and see if page.output is false and if so i don’t include it in the site map (like the sitemap page itself, along with the error page).

I use it all the time - I think there are only a few predefined ones, anything else is really a custom front matter variable.

Another example, on a blog I had, I wanted another thing like category or tag (those are predefined ones I forgot about) so i did type - and had 3 types - article, video and download. Then I could put all the videos on one page by looping thru all posts and if page.type == video then they would get listed. Just had to add type to the front matter on each article.