Support Go time format strings in permalinks
authorLuke Francl <look@recursion.org>
Sun, 10 Nov 2019 05:58:38 +0000 (21:58 -0800)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Sun, 10 Nov 2019 10:00:02 +0000 (11:00 +0100)
commit70a1aa345b95bcf325f19c6e7184bcd6f885e454
treefee67032d577cabd8eaf2da981e444be2de7fa4e
parentcafecca440e495ec915cc6290fe09d2a343e9c95
Support Go time format strings in permalinks

In the vein of an ancient TODO about supporting custom date formatting with
strftime, this allows `:`-prefixed Go time format strings in permalink segments.
This allows users to customize date-based permalinks any way they need to.

For example, with a date of 2019-11-09, the permalink `/:06/:1/:2` will render
as `/19/11/9`.

See:

https://github.com/gohugoio/hugo/commit/07978e4a4922bc21c230fee65052232b829bd1ab#diff-0688a3b65c7f5d01aa216f8d9b57fd00R111-R112
https://discourse.gohugo.io/t/implementing-additional-date-formats-for-permalinks/17860
https://github.com/gohugoio/hugo/pull/6488
docs/content/en/content-management/urls.md
resources/page/permalinks.go
resources/page/permalinks_test.go