Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kaushalmodi/hugo-atom-feed
Hugo theme component for ATOM feed custom Output Format
https://github.com/kaushalmodi/hugo-atom-feed
atom-feed custom-output-format hugo hugo-theme-component
Last synced: 16 days ago
JSON representation
Hugo theme component for ATOM feed custom Output Format
- Host: GitHub
- URL: https://github.com/kaushalmodi/hugo-atom-feed
- Owner: kaushalmodi
- License: gpl-3.0
- Created: 2018-06-11T02:40:04.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-02-16T20:58:39.000Z (9 months ago)
- Last Synced: 2024-10-12T22:29:47.711Z (about 1 month ago)
- Topics: atom-feed, custom-output-format, hugo, hugo-theme-component
- Size: 58.6 KB
- Stars: 41
- Watchers: 3
- Forks: 13
- Open Issues: 6
-
Metadata Files:
- Readme: README.org
- License: LICENSE
Awesome Lists containing this project
README
*This is not a standalone theme. This is a Hugo theme component.*
This component enables ATOM feeds for your site.
* Requirements
You need to install the latest version of Go from
https://go.dev/doc/install because this theme component requires [[https://gohugo.io/hugo-modules/use-modules/][~hugo
mod ..~ commands]] to work.This update on switch to using Hugo Modules was last tested with Hugo
v0.92.0.
* Installing
1. Add this component as a new module to your site's TOML config file:
#+begin_src conf-toml
[module]
[[module.imports]]
path = "github.com/kaushalmodi/hugo-atom-feed"
#+end_src
2. Add "ATOM" to all the Page Kinds for which you want to create ATOM
feeds:
#+begin_src conf-toml
[outputs]
# /atom.xml
home = ["HTML", "RSS", "ATOM"] # default = ["HTML", "RSS"]
# /posts/atom.xml
section = ["HTML", "RSS", "ATOM"] # default = ["HTML", "RSS"]
# /tags/mytag/atom.xml, /categories/mycat/atom.xml
taxonomy = ["HTML", "RSS", "ATOM"] # default = ["HTML", "RSS"]
#+end_src
* Selectively excluding pages from the feed
For the pages that you would like to exclude from the feed, set the
~disable_feed~ parameter in its front-matter to ~true~.#+begin_src conf-toml
disable_feed = true
#+end_src* Pay attention to web server MIME type
To fully comply with web standards, make sure your web server will
send the correct [[https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Type][/Content-Type/ HTTP response header]] for the feed file
name ~atom.xml~. The correct response header looks like this:#+begin_example
Content-Type: application/atom+xml; charset=UTF-8
#+end_exampleNote that even though the feed file extension is ~.xml~, the [[https://developer.mozilla.org/docs/Web/HTTP/Basics_of_HTTP/MIME_types][MIME type]]
here 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. So it is a good idea to play safe. How
you could achieve this depends on the type of web server software you
are running your website on.
** Specifying the correct ~Content-Type~ for Netlify
You can specify the /Content-Type/ of ~atom.*~ and ~*.atom~ files to
be ~application/atom+xml; charset=UTF-8~ using the below in your site's
~netlify.toml~:
#+begin_src conf-toml
[[headers]]
for = "atom.*"
[headers.values]
Content-Type = "application/atom+xml; charset=UTF-8"
[[headers]]
for = "*.atom"
[headers.values]
Content-Type = "application/atom+xml; charset=UTF-8"
#+end_src
*** References
- [[https://www.netlify.com/docs/headers-and-basic-auth/]]
- [[https://www.netlify.com/blog/2017/10/17/introducing-structured-redirects-and-headers/]]
** Note about Google Chrome
Note that Google Chrome currently still [[https://bugs.chromium.org/p/chromium/issues/detail?id=84][features a bug]] for such MIME
types so that automatic XML rendering is not performed. You may
decide what is more important for you: watching the rendered source in
your browser once in a while, or maximum feed reader compatibility 😉.