This blog is made with Maria Kittaka's wonderful Zonelets blog making tool. But I was a little disappointed to see there isn't really a way to easily make a subscribable feed out of blog posts you make automatically. It turns out, on a static site maker like Neocities making this process entirely automatic is really hard, but I think I have the next best thing.

How to make your own feed

  1. Set up a blog with Zonelets
  2. Add the code snippet to the very end of your script.js

    
    // Atom feed gen v1
    
    // This requires posts to follow naming convention 'posts/YYYY-MM-DD-titlehere
    // Also, order the posts array so newest is at the top!
    
    // edit the fields inside!
    
    function atomFeedGen() {
      //==[ CHANGE THESE ]==
      
      // parent dir of this script.js goes here
      // as in, if the script is at /blog/script.js, put something like this
      // but if your blog is in the top level folder, just put the url for your website without the /blog/ at the end
      let blogURL = "https://yoursitehere.neocities.org/blog/"
      // generate something here from https://www.guidgenerator.com/
      // dont leave it as it is!
      let guid = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
      // utc offset
      // you might find it at https://www.timeanddate.com/time/zone/usa if you are american, or somewhere else if not idk
      let timeOffset = "-05:00"
      
      //====================
      
      let atom = ""
      atom += '<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom">'
      atom += '<title>' + blogName + '</title>'
      atom += '<link href="' + blogURL + '/index.html"/>' // may need changing?
      atom += '<updated>' + new Date().toISOString() + '</updated>'
      atom +=  '<author><name>' + authorName + '</name></author>'
      atom += '<id>' + guid + '</id>'
      
      // now entries
      for (i = 0; i < Math.min(postsArray.length, 15); i++) {
        let post = postsArray[i]
        let postURL = blogURL + post[0]
        let postTitle = formatPostTitle(i)
        // posts default to noon time
        let postTime = post[0].substring(6,16) + "T12:00:00" + timeOffset 
        atom += '<entry>'
        atom += '<title>' + postTitle + '</title>'
        atom += '<link href="' + postURL + '"/>'
        atom += '<id>' + postURL + '</id>' // bad, this should be a guid! but we have nothing else to use
        atom += '<updated>' + postTime + '</updated>'
        atom += '</entry>'
      }
      
      atom += '</feed>'
    
      return atom
    }
              
  3. Follow the Zonelets instructions for adding blog posts to your script.js as normal. Make sure you format the dates in the right format described in the code comments (even if you don't have to), and also make sure you add posts at the top of the list instead of at the end (the code only looks at the top 15 items in the list!)
  4. If all goes well, the feedgen function is now defined on your blog's homepage! Run it by opening your browser's devtools (probably with F12 or Ctrl+Shift+I), navigating to the 'Console' tab, and sending atomFeedGen()
  5. You'll see an html-ish looking string appear. Copy it (make sure to remove any quote marks around it), paste it into a file anywhere on your website named 'feed.xml', and you're done! Now you can enter the link to your feed into a feed reader, and you should see your posts come up!
  6. This will not update on its own. After adding a new item to your posts list, youll have to re-run the function to get a new xml that you'll need to manually paste. Once you do though, itll go out to anyone subscribed to your feed!