Can I use {{page.date}} with a Collection has format YYYY-MM-DD-filename.md in Jekyll? -
from document read on jekyll , around internet, posts in _posts
directory in yyyy-mm-dd-filename.md
format , date can retrieved using {{page.date}}
liquid variable without need of specify yaml front matter "date".
however, created collection @ same level of _posts
, called _collections
. question is: can setup retrieved date of markdown files in collection without front matter, used in _posts
?
additionally, want know how can markdown files in _posts
can have property? , if there's solution, can use github pages?
given have collection page url /folder/2015-11-29-some-words-here.html
, can mimic posts date :
{% assign filename = page.url | split: "/" | last %} {% assign elements = filename | split: "-" %} {% capture datestring %}{{elements[0]}}-{{elements[1]}}-{{elements[2]}}{% endcapture %} {{ datestring | date: "%a, %b %d, %y" }}
Comments
Post a Comment