carpentries / tnd-carpentries-working

The Carpentries new website BEFORE the Hugo theme was packaged out. Not currently maintained.
https://tnd-carpentries-website.netlify.app/
0 stars 0 forks source link

Date format #81

Closed maneesha closed 4 months ago

maneesha commented 5 months ago

The date format across the site should be: 10 May, 2024.

Examples where this should apply:

maneesha commented 5 months ago

This should be set globally. Just to test this out though, I changed the date format in terms.html from {{ .Date.Format "2006-02-03" }} to {{ .Date.Format "2 April, 2006"}}.

Note also that our dates are generally in ISO format (YYYY-MM-DD). So from what I understand of how Hugo formats dates, even with the short date format, it should be "2006-01-02"

AdamChlan commented 4 months ago

@maneesha I have updated the date format on those pages. There is no way to set a default date format in Hugo, so I adjusted as needed.

maneesha commented 4 months ago

Thanks @AdamChlan It looks like we can set a date format in the site params and use it in the theme. I just tried it and it works, but that is not really what we want. Is it possible to set params at the theme level?

regisphilibert commented 4 months ago

We can use a parameter which could be overridden by the project. Something like:

{{ date.Format (site.Params "date_format" | default "2 April, 2006") }}
AdamChlan commented 4 months ago

@maneesha I merged in work to get this in place the best way for Hugo. You can see the work in this PR:

https://github.com/carpentries/tnd-carpentries-working/pull/93