RSS Solutions

İsmail Efe Top


My problem

I love reading personal blogs, since I love them so much I decided to make one myself a couple of weeks ago.

There were a lot of framework projects for personal blogs like hugo, Astro JS and Jekyll. But for different reasons I found them quite restrictive. Since I was already using Emacs for most of my writing I thought I could use org-mode to write blog posts and use pandoc to convert them to HTML. It worked quite well. This is blog is the result of that. But this method has it's downsides, you have to do some manual labor. And this includes RSS.


RSS is "a standardized system for the distribution of content from an online publisher." In a nutshell, it is a file you host that has all the important metadata like what are the posts in your blog, who wrote them, and what are the posts about.

The frameworks I mention have solutions for automating the generation of RSS files. I also found a solution that works for exactly what I do, webfeeder. With the webfeeder I was able to achieve the bare minimum, but anything more than that required a more extensive knowledge of the lisp language.

After all this, I felt like I had to dive deeper to RSS. I already had a basic understanding, but looking at the RSS feeds of different sites gave me the knowledge and the courage to write a script that automated RSS generation.

Basics of RSS

RSS is simply a big nested XML file. You start by declaring the usage and the version of the file.

<rss xmlns:atom="" version="2.0">

Then you open a channel tag and give your basic information.

<title>İsmail Efe's Blog Site</title>
<description>İsmail Efe's Second Brain.</description>
<atom:link href="" rel="self" type="application/rss+xml"/>
<lastBuildDate>Thu, 01 Feb 2024 11:27:51 +0300</lastBuildDate>

Now we can start giving it the key items. These are going to be your posts. I am going to give you an example.

<title>My EDC Essentials.</title>
<![CDATA[ <!DOCTYPE html> <html xmlns="" lang="" xml:lang=""><body>YOUR HTML CONTENT</body></html> ]]>
<author> (İsmail Efe Top)</author>
<pubDate>Sun, 14 Jan 2024 00:00:00 +0300</pubDate>

Let's tie the loose ends.


This is what a basic RSS file for a blog looks like.


I wanted to write this script in rust but I am still learning, so I decided to use python for this. Here is what I did.

from datetime import datetime
from bs4 import BeautifulSoup

system_header = "/Users/ismailefetop/projects/org-blog/ismailefe_org"
website_header= ""
blog_posts = ["/blog/my_edc/index.html",

update_time = str('%a, %d %b %Y %H:%M:%S'))+' +0300'

feed_output = "/Users/ismailefetop/projects/org-blog/ismailefe_org/feed.xml"
xml_file = open(feed_output, "w")

f'''<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="">
<title>İsmail Efe's Blog Site</title>
<description>İsmail Efe's Second Brain.</description>
<atom:link href="" rel="self" type="application/rss+xml"/>


# Below function is partially written by ChatGPT.
def parse_html(filename_arg):
    # Read the HTML file
    with open(filename_arg, 'r', encoding='utf-8') as file:
        html_content =

    # Parse the HTML content using BeautifulSoup
    soup = BeautifulSoup(html_content, 'html.parser')

    # Extract title
    title_tag = soup.find('title')
    title = title_tag.text if title_tag else None

    # Extract date (assuming date is in an element with class="date")
    date_tag = soup.find(class_='date')
    date = date_tag.text if date_tag else None

    # Extract body content as HTML
    body_tag = soup.body
    body_html = str(body_tag) if body_tag else None

    post_dict = {"title":title,"date":date,"body_html":body_html}

    return post_dict

# Below function is written by ChatGPT.
def format_date(input_date):
    # Convert input date string to a datetime object
    input_datetime = datetime.strptime(input_date, '%Y-%m-%d')

    # Format the datetime object to the desired string format
    formatted_date = input_datetime.strftime('%a, %d %b %Y')

    return formatted_date

for post in blog_posts:
    post_dictionary = parse_html(system_header+post)
    xml_file = open(feed_output, "a")
  <description><![CDATA[<!DOCTYPE html>
<html xmlns="" lang="" xml:lang="">{post_dictionary["body_html"]}</html>]]></description>
  <author> (İsmail Efe Top)</author>
  <pubDate>{format_date(post_dictionary["date"])} 00:00:00 +0300</pubDate>

xml_file = open(feed_output, "a")

When I write a new post, all I have to do is add the name of the post to the blog posts list. Feel free to modify it to your heart's content. As a note, while working on this project, I used the RSS Validator. This site checks whether your RSS feed is valid and highlights any problems you might have. It really is a life-save when working on RSS files.

Home Mail Me RSS Source