How to write an atom feed ?


ATOM feeds let one subscribe to your website and get latest content. It is free. It can be used to publish content.

ATOM is RSS improved.

Instead of relying on provate social networks, you should consider using feeds.

Let's see how to write an ATOM feed.

First, insert a header :

<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet href="/atom.xsl" type="text/xsl"?>
<feed xmlns="">
  <title>log de prx</title>
  <link rel="alternate" type="text/gemini" href="gemini://"/>
  <link rel="alternate" type="text/html" href=""/>
  <link rel="self" type="application/atom+xml" href=""/>

As you can see, the two first line are xml declaration, the 2nd call a stylesheet to display the atom feed. It is optional.

Then, we open a tag "<feed>".

id should be unique, use an URL as example.

You should specify linksto tell where is the content (alternate) and where the feed actually is (self) in case of redirections. Add an author section if you want.

Finally, insert a date when your feed has been updated. It has to be modified each time you update your feed. Format is <year>-<month>-<day>T<hour>:<minutes>:<seconds>Z.

Then, you can add entries : they are your content. 1 entry = 1 article. Add as many as you want.

    <title type="text">Youtube to mpd</title>
    <link rel="alternate" type="text/gemini" href="gemini://"/>
    <content type="text"><![CDATA[
	Some stuff...
	Your article...

As you can see, you can write some metadata :

To end an entry :

Finally, close your feed since it must be XML valid content.


That's it 😉

See also

About feeds.

What is Atom ?

atom.awk to generate an atom feed (http)

atom.awk to generate an atom feed (gemini)