Coder Social home page Coder Social logo

hugo-atom-feed's Introduction

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 ~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:
    [module]
      [[module.imports]]
        path = "github.com/kaushalmodi/hugo-atom-feed"
        
  2. Add “ATOM” to all the Page Kinds for which you want to create ATOM feeds:
    [outputs]
      # <domain>/atom.xml
      home = ["HTML", "RSS", "ATOM"]     # default = ["HTML", "RSS"]
      # <domain>/posts/atom.xml
      section = ["HTML", "RSS", "ATOM"]  # default = ["HTML", "RSS"]
      # <domain>/tags/mytag/atom.xml, <domain>/categories/mycat/atom.xml
      taxonomy = ["HTML", "RSS", "ATOM"] # default = ["HTML", "RSS"]
        

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.

disable_feed = true

Pay attention to web server MIME type

To fully comply with web standards, make sure your web server will send the correct /Content-Type/ HTTP response header for the feed file name atom.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 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:

[[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"

References

Note about Google Chrome

Note that Google Chrome currently still 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 😉.

hugo-atom-feed's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

hugo-atom-feed's Issues

Queries related to Feedly

@kaushalmodi I have a Feedly link https://feedly.com/f/XXXXXX.atom which I want to put in one of the child pages. I followed your steps:

Clone this repo to /themes/hugo-atom-feed directory.

Now I have 2 themes:

 $ls
docsy		hugo-atom-feed

Modify config.toml

Hugo allows theme composition (and inheritance). The precedence is from left to right.
theme = ["hugo-atom-feed", "docsy"]

I didn't understand your 3rd step.

Add “ATOM” to all the Page Kinds for which you want to create ATOM feeds:

Where do I need to add this exactly?

Implement WebSub?

As of January 2018 WebSub is a W3C Recommendation.

Google does not link to the spec on their site but they do suggest its predecessor, PubSubHubub:
https://developers.google.com/search/docs/guides/submit-URLs

My understanding of the intent of this protocol is to inform subscribers (a kind of end user, such as flipboard) of an update on a specific topic made available by a publisher. Benefits include 1) subscribers, such as crawlers, do not need to poll as often for updated info—saving resources across the board—and 2) publishers could better automate content discovery.

Here's more info in English on Wikipedia: https://en.wikipedia.org/wiki/WebSub

Beyond that I have not looked into this further but this feels like a good place to raise this for investigation, doc and possible implementation. Curious to hear your thoughts @kaushalmodi.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.