This is a GoHugo theme component that implements various configurable feed formats. Currently implemented formats are RSS, Atom and JSONfeed.
|Add this module|
[[module.imports]] path = "github.com/davidsneighbour/hugo-feeds" disable = false ignoreConfig = false ignoreImports = false
|Fix to this version||
hugo mod get github.com/davidsneighbour/[email protected]
- proper implementation of the formats
- JSON feed
- add hooks (for all feed formats or individual feed formats)
- configurable section-, taxonomy- and term-feeds
- partial to output list of available feeds on your website
- proper testing, validation and dev-site
First enable modules in your own repository:
1hugo mod init github.com/username/reponame
Then add this module to your required modules in config.toml.
The next time you run
hugo it will download the latest version of the module.
hugo-feeds uses a cautious approach at configuring the output of the feeds. Where GoHugo’s internal RSS template prints all available pages without a configured limit,
hugo-feeds will load only the 10 latest pages/posts, but you can configure at your pleasure.
services.rss.limit is defined and NOT overridden by any other configuration then these values will be choosen for RSS. Limits for specific feed formats can be configured explicitly.
Limits are formatted via integers. 0 disables, everything at 1 and over selects the last x items and -1 will list all items.
Posts to show in feeds
posts to show only items that are listed in
params.mainSections in your feeds. All other values will result in all pages being included.
Have a read through @zbetz’s great article Discreet Drafts in Hugo and rest assured that without configuration this module will hide all drafts (posts with
draft in their frontmatter set to
true) from it’s feeds. If you wish to force drafts being shown in the feeds then set
hugo-feeds implements template hooks via
hugo-hooks and makes the following hooks available:
|feeds-init||Hooks in after the opening tag. Do not open this to output anything. Just for initialising any of your plugins.|
|feeds-start||Hooks in after the initial first tags that define your feeds purpose and before items of the feed are printed.|
|feeds-end||Hooks in at the end of the feed after the items are printed.|
All hooks exist in a second form containing the feed type and will run then only in that format. For example
feeds-atom-init runs only at the init stage of the atom feed,
feeds-rss-init in rss and
feed-jsonfeed-init in JSONfeeds.