Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add date to front matter in new posts #43

Closed
wants to merge 2 commits into from

Conversation

xianny
Copy link

@xianny xianny commented Sep 2, 2016

When making new posts, I'd like to auto-generate date/timestamp to front matter. Thoughts?

@timothyekl
Copy link

This is the very first feature I found myself wanting when first trying jekyll-compose. +1

@wrobbins
Copy link

wrobbins commented Jun 18, 2017

Bump ? Would also like this feature

@jandudulski
Copy link
Contributor

@parkr any chances for this? :)

@pathawks
Copy link
Member

LGTM

Copy link
Member

@parkr parkr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! One request for the subclass implementation of #content, and it'd be great to have a quick test for this!

@@ -53,6 +53,11 @@ def file_name
def _date_stamp
@params.date.strftime '%Y-%m-%d'
end

def content
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Subclasses should accept the same number of arguments as the superclass so this should be def content(front_matter = {}).

def content(front_matter = {})
  front_matter.merge!({"date" => @params.data.strftime("%Y-%m-%d %H:%M %z")})
  super
end

That should work.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xianny can you update this please :)?

@jekyll jekyll locked and limited conversation to collaborators Apr 23, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants