0
votes

I am aware you can add and use html page custom front matter fields using the {{ page.myField }} directive but this does not work for posts (i.e. when iterating site.posts in a for loop.

My problem, what I have done ...

  1. I created a new post in _posts with a .md extension containing new custom front matter fields (it is published and refixed correctly with date) - Seems correct

  2. I loop all the posts using {% for post in site.posts %} - This works

  3. When I attempt to use these using a liquid tag {{ post.myNewField }} it is not available but does show in post.content as text not a useable field.

Surely this cannot be correct. I would assume anything in the markdown in the front matter section should be accessible, as it seems to say so in the Jekyll front matter instruction http://jekyllrb.com/docs/frontmatter/#custom-variables

Please help.

1
And your post is starting with a yaml-header, containing the variables, enclosed with three dashes (---)?astark
Not really easy to reproduce. Where did 3. happends ? Did you use {{ post.myNewField }} in the post itself, in layouts/post.html ? Maybe you have a github repository url to submit.David Jacquel
yes posts start with '---' yaml-header. 3 happens in another index.html file, the for loop is inside this html file. github repo is private.kernowcode

1 Answers

0
votes

cause of my issue was UTF-8-DOM encoding when it should have just been UTF-8 encoding for .md files