sitemap

a very hacky script to generate a xml item for your rss feed

so rss is this really cool tech we all love but when you're writing your entire static website by hand you also have to update your feed by hand and it gets just slightly annoying. i don't really know python but it's a testament to the language's noob-friendliness that i quickly wrote a basic script to do this for me, saving probably no more than two minutes of effort whenever i update my feed. it could be better but works for now. i'll edit the page if i can improve it.

readme / guide

look i'm sorry but my guide pressuposes basic command line stuff like knowing where you are and how to change directories. i believe in you. oh and obviously you need python. i'm pretty sure the script doesn't need v3, but it's what i have in this machine.

if you'd rather have a graphical interface, i recommend karma chameleon's tool, which does this with js on your browser. russhdown is a similar tool that can generate and update the xml file itself, it's meant more as a rss-as-social-media thing where you use it for posts rather than to talk about updates, but you can use it in whatever way you like so. i'm sharing.

you'll also need a xml feed to update. here's a simple rss setup guide for that.

the script


from time import localtime, strftime

# get date time and format it properly

# change the '-0300' part to your UTC offset 
pub_date = strftime("%a, %d %b %Y %H:%M:%S -0300", localtime())

# get info like title etc
title = input("title: ")
path = input("path: ")
description = input("description: ")

# final copy pastable item
print(
"""
<item>
      <title>""" + title + """</title>
      <pubDate>""" + pub_date + """</pubDate>
      <link>https://solflo.neocities.org/""" + path + """</link>
      <description><![CDATA[ 
      """ + description + """
       ]]></description>
  </item>
"""
)

you're welcome to modify and redistribute the code to your heart's content. and maybe let me know if you can automate the utc offset part thing?


sitemap