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
Allow custom date formats #164
Comments
Date formats are exposed to the templates, use the Liquid's date filter, e.g.
List of format descriptors: http://liquid.rubyforge.org/classes/Liquid/StandardFilters.html#M000012 |
So is there a chance of getting date format added as a top-level preference? Otherwise, where in the template files must this be modified? |
Looking through the source, the files all use _includes/post/date.html, but I see no such line in there? I think this being an option in the config file is useful, e.g. |
Good point. I'll add a config flag for date … |
I had a look at this issue again, unfortunately something like |
Interesting. Which template files would need to be edited, and how? It could be added to the documentation, I suppose. Why not let Jekyll/Ruby take care of the date format? It could be argued that the date format is something a site author would want to set regardless of the template used, so not using the Liquid filter isn't so bad. |
You only need to modify Default date output in Ruby looks like this: |
I was thinking more of Ruby's strftime method: This could then be used in conjunction with a config variable. |
Ok, I found a solution: I monkey patched Jekyll's to_liquid method to not just provide |
Brilliant! Should make those of us not in the US happier with the date formats! |
Turns out this works for blog posts, but not static pages. The time information in the tags is empty. Is it supposed to take care of formatting the updated date too? |
It's only applied to posts so far, but I'll add it for pages, too (I need to override Jekyll's own methods for that). In a later commit, I removed the support for "updated":
|
Does that mean that other commit mean we can no longer get last updated info displayed on pages? It was working previously. |
@sfahmy Do you set the |
Correct, I set the |
It looks like this is already somehow doable in Jekyll: |
Ah, ok. I'll add back support for |
@sfahmy: Updated flag is back and custom dates work on pages, too. |
Great, works perfectly! Now I need to see how I might hack it so it ordinalizes even non standard date formats :) But that looks hard! |
No, it's not. ;) I just added |
Fantastic! There's an error on line 39 though. It should read : The extra I just fixed it locally. |
The second |
Reverts changes of c2a68cc where I accidentally removed support for 'updated' field, see comments of issue imathis#164 for details.
It seems the date formats for display are coded deep in the engine somewhere and not exposed through the templates or configuration files. It would be good to allow users to modify the date format.
The text was updated successfully, but these errors were encountered: