This Hugo module adds Atom feed support, and provides an update to the default RSS feed.
We use Codeberg for development, suggestions, issues, and pull requests.
Note: These mirrors should not be used as a Hugo module as it will produce a GoLang module error. The
go.mod
ID is set tocodeberg.org/yelosan/hugo-feeds
which should match the URL Hugo/GoLang is fetching it from.
- In your
config
file, add the following:
TOML
[module]
[[module.imports]]
path = "codeberg.org/yelosan/hugo-feeds"
YAML
module:
imports:
- path: codeberg.org/yelosan/hugo-feeds
JSON
{
"module": {
"imports": [
{
"path": "codeberg.org/yelosan/hugo-feeds"
}
]
}
}
- Initialize the Hugo Feeds module
hugo mod init codeberg.org/yelosan/hugo-feeds
To update the Hugo Feeds module, run this command while in your project's root directory: hugo mod get -u codeberg.org/yelosan/hugo-feeds
- In your project's root directory, run the following command
git submodule add https://codeberg.org/yelosan/hugo-feeds themes/hugo-feeds
- Initialize the Hugo Feeds submodule
git submodule update --init --recursive themes/hugo-feeds
While in your project's root directory, run this command: git submodule update --init --recursive themes/hugo-feeds
- In your project's root directory, run
git clone https://codeberg.org/yelosan/hugo-feeds themes/hugo-feeds
In the Hugo Feeds subdirectory (cd themes/hugo-feeds
), run this command: git pull
- Download the
main
branch, or tag of your choice, here. - Extract the file in your project's
/themes/
subdirectory. It should be in/themes/hugo-feeds/
after extracting.
- Check the project's repository regularly for updates.
- Download the
main
branch, or tag of your choice, here. - If you did not modify any of the Hugo Feeds files, delete the
/hugo-feeds/
subdirectory located in your project's/themes/
subdirectory. - Extract the latest release in your project's
/themes/
subdirectory. It should look like this after extracting:/themes/hugo-feeds/
.
- Add "ATOM" to all the Page Kinds you want to generate an Atom
feed.xml
TOML
[outputs]
# <domain>/feed.xml
home = ["HTML", "ATOM", "RSS"]
# <domain>/posts/feed.xml
section = ["HTML", "ATOM", "RSS"]
# <domain>/tags/mytag/feed.xml; <domain>/categories/mycat/feed.xml
taxonomy = ["HTML", "ATOM", "RSS"]
YAML
outputs:
home:
- HTML
- ATOM
- RSS
section:
- HTML
- ATOM
- RSS
taxonomy:
- HTML
- ATOM
- RSS
JSON
{
"outputs": {
"home": ["HTML", "ATOM", "RSS"],
"section": ["HTML", "ATOM", "RSS"],
"taxonomy": ["HTML", "ATOM", "RSS"]
}
}
- Extra step for Methods B, C, and D.
Add this in your config
file
TOML
theme = ["hugo-feeds", "your-theme"]
YAML
theme:
- hugo-feeds
- your-theme
JSON
{
"theme": ["hugo-feeds", "your-theme"]
}
To fully comply with web standards, make sure your web server sends the correct /Content-Type/ HTTP response header for the feed file name feed.xml
. The correct response header looks like this: Content-Type: application/atom+xml; charset=UTF-8
Note that even though the feed file extension is .xml
, the MIME type is slightly adjusted from application/xml
to application/atom+xml
.
While this might not be important for many feed readers, it could still be a source of error. It is a good practice to be compliant with the web standards, and avoid potential errors. Please consult the documentation of your web hosting provider, or web server software, on how to set the correct MIME type.
You can specify the /Content-Type/ of feed.xml
and *.atom
files to be application/atom+xml; charset=UTF-8
by adding this in your site's netlify.toml
:
[[headers]]
for = "feed.xml"
[headers.values]
Content-Type = "application/atom+xml; charset=UTF-8"
[[headers]]
for = "*.atom"
[headers.values]
Content-Type = "application/atom+xml; charset=UTF-8"
The Hugo Feeds module also contain an override template for the RSS feed. This version matches what is available in the Atom feed, where possible. RSS is enabled by default in Hugo, and the default file name is index.xml
. Simply ensure you have not disabled RSS in your project (check your config
file).
Based on / forked from: