make pubdate nice

This commit is contained in:
Anish Lakhwara 2023-04-03 23:59:16 +10:00
parent e9dce2fe13
commit a785d208f9

View file

@ -8,7 +8,7 @@ import random
import platform import platform
import re import re
import shutil import shutil
from datetime import datetime from datetime import datetime, timezone, timedelta, tzinfo
# Default encoding # Default encoding
encoding = 'utf-8' encoding = 'utf-8'
@ -541,8 +541,10 @@ def create_rss_feed(rss_entries, rss_template, rss_item_template, site_folder):
'rssItemTitle', rss_entry["title"]) 'rssItemTitle', rss_entry["title"])
entry_template = entry_template.replace('rssItemUrl', build_url entry_template = entry_template.replace('rssItemUrl', build_url
+ rss_entry["slug"]) + rss_entry["slug"])
date = datetime.strptime(rss_entry["iso_date"], "%y%m%d-%H%M")
date = date.strftime("%a, %d %b %Y %H:%M")
entry_template = entry_template.replace( entry_template = entry_template.replace(
'rssItemDate', rss_entry["iso_date"]) 'rssItemDate', date)
entry_template = entry_template.replace( entry_template = entry_template.replace(
'rssItemContent', rss_entry["pageContent"]) 'rssItemContent', rss_entry["pageContent"])
rss_items += entry_template rss_items += entry_template