# Custom date in archetypes

**URL:** <https://discourse.gohugo.io/t/custom-date-in-archetypes/6465>\
**Category:** support\
**Created:** [May 6, 2017, 7:40pm UTC](https://discourse.gohugo.io/t/custom-date-in-archetypes/6465 "2017-05-06T19:40:21Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Minimouse](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/minimouse/32/1174_2.png) [@Minimouse](https://discourse.gohugo.io/u/Minimouse)\
**Post date:** [May 6, 2017, 7:40pm UTC](https://discourse.gohugo.io/t/custom-date-in-archetypes/6465/1 "2017-05-06T19:40:21Z")

</div>

I checked the archetype doc: [https://gohugo.io/content-management/archetypes/#hugo-docs-custom-archetype](https://gohugo.io/content-management/archetypes/#hugo-docs-custom-archetype) but found no mention of the possibility of custom dates,

is it possible to format the date to get something like this (stopping at minutes):  
date: 2017-05-04T06:50

thanks!

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [May 6, 2017, 8:10pm UTC](https://discourse.gohugo.io/t/custom-date-in-archetypes/6465/2 "2017-05-06T20:10:22Z")

</div>

Currently no, but I’m not sure why it matters – you can easily truncate/format the date when you present.

---

<div class="post-metadata">

**Author:** ![Minimouse](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/minimouse/32/1174_2.png) [@Minimouse](https://discourse.gohugo.io/u/Minimouse)\
**Post date:** [May 6, 2017, 8:47pm UTC](https://discourse.gohugo.io/t/custom-date-in-archetypes/6465/3 "2017-05-06T20:47:57Z")

</div>

i currently edit dates to order posts on my frontpage, this would make them easier to read, but yes this might not be the most efficient way,

is it possible maybe to sort posts by date (just taking the year and day into consideration) then sort them by weight?

i checked [https://gohugo.io/templates/lists/#by-weight](https://gohugo.io/templates/lists/#by-weight) but i don’t see any way to customize it,

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [May 6, 2017, 9:53pm UTC](https://discourse.gohugo.io/t/custom-date-in-archetypes/6465/4 "2017-05-06T21:53:25Z")

</div>

We will revise the archetype handling (and many people ask for it, so better sooner than later), and one of the things we’re going to do is to allow template syntax in these archetype files. This way you can do `date = {{ now.Format "2006-01-02" }}` or whatever. But we need for someone to get to it first …

---

<div class="post-metadata">

**Author:** ![lebarde](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/lebarde/32/2207_2.png) [@lebarde](https://discourse.gohugo.io/u/lebarde)\
**Post date:** [May 6, 2017, 10:06pm UTC](https://discourse.gohugo.io/t/custom-date-in-archetypes/6465/5 "2017-05-06T22:06:25Z")

</div>

I can add some testimonial.

1. It is clear to me that the date format inside the content frontmatter is not the date format that will be displayed on the website, as @bep said.
2. Now I created an article to be published with Hugo and Latex with Pandoc. And here there was an issue because the date format with Pandoc is copied verbatim on the document heading if it is not understood, which is the case with de default date format in the frontmatter. So for sustainable writing, it might be good to consider that, although this is not for my needs.
3. @Minimouse: are you estimating that frontmatter late is not readable enough as is? I am specifically speaking about the raw file readability. Is that most important for you?

---

<div class="post-metadata">

**Author:** ![Minimouse](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/minimouse/32/1174_2.png) [@Minimouse](https://discourse.gohugo.io/u/Minimouse)\
**Post date:** [May 7, 2017, 7:16am UTC](https://discourse.gohugo.io/t/custom-date-in-archetypes/6465/6 "2017-05-07T07:16:45Z")

</div>

thanks a lot for the inputs!

> are you estimating that frontmatter late is not readable enough as is? I am specifically speaking about the raw file readability. Is that most important for you?

The frontmatter is readable enough i think, except for the date,

the date is quite hard to read for me, I often edit the wrong part, but if it’s possible to limit the amount of infos included it would be way easier, it happens when i edits lot of entries and try to work as fast as possible,

going from:  
date: 2017-05-07T08:52:13+02:00  
to  
date: 2017-05-07T08:52  
would probably ease the reading,

i don’t know if the “T” in the date is a norm, but it’s way less readable than something like  
2017-05-07\_08:52:13+02:00  
the “T” makes the date looks like a single block,
