atom.awk §


mkdir posts
vi posts/entry1.txt
# write something, 
#    first line is title,
#    second line is post's date you can get with "date +'%Y-%m-%dT%TZ'"
$ awk -f atom.awk \
    -v domain="mydomain.tld" \
    -v author="batman.tld" \
    posts/ > atom.xml

# upload atom.xml on your server

Description §

Whether you write files in plain text, markdown or any other markup language, you may want to create an atom feed. An atom feed with html content is a pain and restrictive. atom.awk let you publish your posts without any changes, in plain text as example. Doing so, you can publish an ATOM feed only blog such as suggested on

This tool take a list of file as input and will generate an atom feed with the content of each fil as description.

No need for html escape or any conversion : it is plain text in a CDATA tag.

You can even write "]]>" in your pages, it will be escaped.

Each post 1st line is the title. Post's 2nd line is publication date. Date format must be "%Y-%m-%dT%TZ". Use ''date +%Y-%m-%dT%TZ''.

atom.awk is an awk script, available on most unix-like.

Options §

Use ''-v flag'' when calling atom.awk to adjust the following options:

Of course, you can edit source code to add more elements to the header, such as ''<rights>'' tag or ''<icon>''.

Full example §

Call atom.awk with minimal variables :

awk -f atom.awk -v domain="" -v author="prx" -v feedtitle="prx's blog" posts/

Or if you want to setup all options. Notice it will give the exact same output as above :

awk -f atom.awk \
    -v max=100 \
        -v protocol="https" \
    -v domain="" \
    -v feedurl=""
    -v author="prx"\
    -v email=""\
    -v feedtitle="prx's blog"\

Download §


See also §