Implementing additional date formats for permalinks


I’m opening this to discuss a new feature, as recommended by the contribution guidelines.

I have a site using a custom CMS which I would like to migrate to Hugo. However, the URL structure is not representatble with Hugo’s current permalink options, because it uses decimal month and day numbers (not zero padded). For example: /2019/3/9.

I found this comment by Phil Pennock back in 2013 about adding support for additional formats using strftime:

I would be happy to work on that if there is interest in incorporating it into Hugo.

Another, less general, approach would be to add a few more permalink options, named something like :decimalmonth or :monthdecimal.

1 Like

I’m not a hugo dev, but my two yen are: it sounds like a good idea because it allows more flexibility in moving to hugo, and, it allows a builder to avoid creating aliases.

I have not tested it with your use case of “decimal dates”, but one way to solve the problem may be to make an alias in your markdown files, which would serve to redirect the visitor to the page with its hugo-compatible url path.

Many months later update: I’ve authored a change to permalinks so that you can use Go time formatting directives in them, so this is now possible!