From 9b0fb750431377864c708c10b42bc54708db7da6 Mon Sep 17 00:00:00 2001 From: Yax <1949284+kianby@users.noreply.github.com> Date: Sat, 24 Aug 2019 09:39:49 +0200 Subject: [PATCH] RSS --- layout/rss.xml | 6 ++---- layout/rss_item.xml | 1 + layout/sitemap.xml | 1 + layout/sitemap_item.xml | 2 +- makesite.py | 6 +++++- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/layout/rss.xml b/layout/rss.xml index 8a0a33e..19d257c 100644 --- a/layout/rss.xml +++ b/layout/rss.xml @@ -1,12 +1,10 @@ - - + {{ title }} {{ site_url }}/ {{ subtitle }} - + {{ content }} - diff --git a/layout/rss_item.xml b/layout/rss_item.xml index b3981ad..dc8823b 100644 --- a/layout/rss_item.xml +++ b/layout/rss_item.xml @@ -1,4 +1,5 @@ +{{ site_url }}/{{ year }}/{{ slug }}.html {{ title }} {{ site_url }}/{{ year }}/{{ slug }}.html diff --git a/layout/sitemap.xml b/layout/sitemap.xml index f1f6a6a..f7358b7 100644 --- a/layout/sitemap.xml +++ b/layout/sitemap.xml @@ -1,3 +1,4 @@ {{ content }} + \ No newline at end of file diff --git a/layout/sitemap_item.xml b/layout/sitemap_item.xml index a718306..f64f821 100644 --- a/layout/sitemap_item.xml +++ b/layout/sitemap_item.xml @@ -1,4 +1,4 @@ {{ site_url }}/{{ date }}/{{ slug }}.html -{{ rfc_2822_date }} +{{ date }} diff --git a/makesite.py b/makesite.py index a551602..c911d1a 100755 --- a/makesite.py +++ b/makesite.py @@ -34,6 +34,8 @@ import glob import sys import json import datetime +import time +from email import utils from pathlib import Path import unicodedata import locale @@ -78,7 +80,9 @@ def read_headers(text): def rfc_2822_format(date_str): """Convert yyyy-mm-dd date string to RFC 2822 format date string.""" d = datetime.datetime.strptime(date_str, '%Y-%m-%d') - return d.strftime('%a, %d %b %Y %H:%M:%S +0000') + dtuple = d.timetuple() + dtimestamp = time.mktime(dtuple) + return utils.formatdate(dtimestamp) def slugify(value):