0
votes

I want my posts to be the same date. So I put the following in my _config.yml file:

defaults:
  -
    scope:
      path: ""
      type: "post"
    values:
      layout: "post"
      date: "31.05.2014"

When I build the site, all posts get post layout, but instead of the date specified in front matter defaults, I get the date specified in the names of the posts initially. Although when I add the date manually to the front matter of each post, it works.

So any idea whether the date can be set in front matter defaults or not? If yes, how can I do it?

1
Can you please try English date formats like 2014-05-19 08:55:27? edit: Can't get it to work myself, sorry. :/kleinfreund
Also, why would you do that? What is your use case?kleinfreund
@kleinfreund I tried English date format, it didn't work for me also. I use posts as articles in a knowledge base. By date I would like to indicate that the information is up-to-date on a certain date. So next time I review the knowledge base I would like to have one place where I can change the date for all posts, instead of doing it manually in each post.jupiteror
What if you don't use Front Matter and only use the same date in the file names? Of course you would still need to adjust these manually.kleinfreund
@kleinfreund that's the point, changing the date manually either way will take a lot of time.jupiteror

1 Answers

1
votes

Based on what you want, I think Jekyll's data feature may be of better use here. You could specify a last_updated_at field with a date in a data file and then use that throughout your site. You could then allow the post filename to indicate when the knowledge base article was created, or bump the post date (if it's not part of the permalink) to indicate when each article was last updated.