Hugo

🡸
last updated:

Some notes on doing things a certain way.

RSS with atom

You have to register the media type in hugo.toml:

[mediaTypes]
[mediaTypes.'application/atom+xml']
suffixes = ['xml']

[outputFormats.Atom]
mediaType = 'application/atom+xml'
baseName = 'feed'

[outputs]
home = ['html, 'Atom']

Then under layouts/_default (either site or theme), create a file named home.atom.xml for your feed template.

expiryDate in Archetype

.Date doesn’t work if you want to use things like time.AddDate, so instead use time.Now (e.g. this will expire 30 days after date):

+++
title = '{{ replace .File.ContentBaseName "-" " " | title }}'
date = {{ time.Now.Format "2006-01-02T15:04:05" }}
expiryDate = {{ time.Now.AddDate 0 0 30 | time.Format "2006-01-02T15:04:05" }}
draft = false
+++