# How to write an atom feed ? 2022-06-15T14:31:10Z 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 : ``` https://si3t.ch/log/ log de prx /favicon.svg prx prx@si3t.ch 2022-06-08T15:55:32Z ``` 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 "". 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 --T::Z. Then, you can add entries : they are your content. 1 entry = 1 article. Add as many as you want. ``` Youtube to mpd gemini://si3t.ch/log/2022-06-06-yt2mpd.gmi 2022-06-06T14:57:30Z ``` As you can see, you can write some metadata : * a title * the id of the entry. It must be unique (the url is quite good). * time when it has been updated (created) * a link to the article. * A new tag to add the content. As example, I show here a plain text content wrapped in CDATA to avoid escaping and issues with html. If you se the type to "html", make sure you escape &,<,>,'," to &, <, >, ' ". To end an entry : * Close the CDATA tag with "]]>" and content tag. * Close entry tag. Finally, close your feed since it must be XML valid content. ``` ``` That's it 😉 ## See also => https://aboutfeeds.com/ About feeds. => https://validator.w3.org/feed/docs/atom.html What is Atom ? => https://si3t.ch/Logiciel-libre/atom-awk.xhtml atom.awk to generate an atom feed (http) => gemini://si3t.ch/Logiciel-libre/atom-awk.gmi atom.awk to generate an atom feed (gemini)