Skip to content

Commit 8f030f2

Browse files
committed
fix rss feed
1 parent 662c8ea commit 8f030f2

File tree

4 files changed

+32
-29
lines changed

4 files changed

+32
-29
lines changed

Diff for: Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ serve:
77
python -m http.server
88

99
watch-build:
10-
ls **/*.md **/*.html *.py | entr ./generate-html.py
10+
ls **/*.md **/*.html **/*.xml *.py | entr ./generate-html.py
1111

1212
update-book: ## assumes book repo is at ../book
1313
cd ../book && make html

Diff for: generate-html.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python
22
# copied from https://github.com/tonybaloney/tonybaloney.github.io/blob/master/blog-gen.py
33
from dataclasses import dataclass
4-
from datetime import date, datetime
4+
from datetime import date, datetime, time
55
from email.utils import formatdate, format_datetime # for RFC2822 formatting
66
from pathlib import Path
77

@@ -30,6 +30,9 @@ def html_path(self):
3030
def url(self):
3131
return f"/blog/{self.html_path.name}"
3232

33+
@property
34+
def rfc2822_date(self):
35+
return format_datetime(datetime.combine(self.date, time(12, 00)))
3336

3437

3538
def main():
@@ -57,7 +60,7 @@ def main():
5760
print("writing", post.html_path)
5861
post.html_path.write_text(post_html)
5962

60-
all_posts.append(post) # TODO rfc2822_date=format_datetime(post_date),
63+
all_posts.append(post)
6164

6265
# Order blog posts by date published
6366
all_posts.sort(key=lambda p: p.date, reverse=True)

Diff for: rss.xml

+18-18
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<description>
77
Simple patterns for building complex apps
88
</description>
9-
<link>https://cosmicpython.com</link>
10-
<lastBuildDate>Tue, 12 May 2020 19:29:59 -0000</lastBuildDate>
9+
<link>https://www.cosmicpython.com</link>
10+
<lastBuildDate>Wed, 13 May 2020 19:49:31 -0000</lastBuildDate>
1111
<pubDate>Sat, 4 Jan 2020 19:15:54 -0500</pubDate>
1212
<atom:link href="https://cosmicpython.com/rss.xml" rel="self" type="application/rss+xml" />
1313

@@ -16,8 +16,8 @@
1616
<description>
1717

1818
</description>
19-
<link></link>
20-
<pubDate></pubDate>
19+
<link>https://www.cosmicpython.com/blog/2020-05-12-ddia-review.html</link>
20+
<pubDate>Tue, 12 May 2020 12:00:00 -0000</pubDate>
2121
<dc:creator>Harry</dc:creator>
2222
<guid></guid>
2323
</item>
@@ -27,8 +27,8 @@
2727
<description>
2828

2929
</description>
30-
<link></link>
31-
<pubDate></pubDate>
30+
<link>https://www.cosmicpython.com/blog/2020-01-25-testing_external_api_calls.html</link>
31+
<pubDate>Sat, 25 Jan 2020 12:00:00 -0000</pubDate>
3232
<dc:creator>Harry</dc:creator>
3333
<guid></guid>
3434
</item>
@@ -38,8 +38,8 @@
3838
<description>
3939

4040
</description>
41-
<link></link>
42-
<pubDate></pubDate>
41+
<link>https://www.cosmicpython.com/blog/2019-08-03-ioc-techniques.html</link>
42+
<pubDate>Sat, 03 Aug 2019 12:00:00 -0000</pubDate>
4343
<dc:creator>David</dc:creator>
4444
<guid></guid>
4545
</item>
@@ -49,8 +49,8 @@
4949
<description>
5050

5151
</description>
52-
<link></link>
53-
<pubDate></pubDate>
52+
<link>https://www.cosmicpython.com/blog/2019-04-15-inversion-of-control.html</link>
53+
<pubDate>Mon, 15 Apr 2019 12:00:00 -0000</pubDate>
5454
<dc:creator>David</dc:creator>
5555
<guid></guid>
5656
</item>
@@ -60,8 +60,8 @@
6060
<description>
6161

6262
</description>
63-
<link></link>
64-
<pubDate></pubDate>
63+
<link>https://www.cosmicpython.com/blog/2017-09-19-why-use-domain-events.html</link>
64+
<pubDate>Tue, 19 Sep 2017 12:00:00 -0000</pubDate>
6565
<dc:creator>Bob</dc:creator>
6666
<guid></guid>
6767
</item>
@@ -71,8 +71,8 @@
7171
<description>
7272

7373
</description>
74-
<link></link>
75-
<pubDate></pubDate>
74+
<link>https://www.cosmicpython.com/blog/2017-09-13-commands-and-queries-handlers-and-views.html</link>
75+
<pubDate>Wed, 13 Sep 2017 12:00:00 -0000</pubDate>
7676
<dc:creator>Bob</dc:creator>
7777
<guid></guid>
7878
</item>
@@ -82,8 +82,8 @@
8282
<description>
8383

8484
</description>
85-
<link></link>
86-
<pubDate></pubDate>
85+
<link>https://www.cosmicpython.com/blog/2017-09-08-repository-and-unit-of-work-pattern-in-python.html</link>
86+
<pubDate>Fri, 08 Sep 2017 12:00:00 -0000</pubDate>
8787
<dc:creator>Bob</dc:creator>
8888
<guid></guid>
8989
</item>
@@ -93,8 +93,8 @@
9393
<description>
9494

9595
</description>
96-
<link></link>
97-
<pubDate></pubDate>
96+
<link>https://www.cosmicpython.com/blog/2017-09-07-introducing-command-handler.html</link>
97+
<pubDate>Thu, 07 Sep 2017 12:00:00 -0000</pubDate>
9898
<dc:creator>Bob</dc:creator>
9999
<guid></guid>
100100
</item>

Diff for: templates/rss_feed_template.xml

+8-8
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@
66
<description>
77
Simple patterns for building complex apps
88
</description>
9-
<link>https://cosmicpython.com</link>
9+
<link>https://www.cosmicpython.com</link>
1010
<lastBuildDate>{{date}}</lastBuildDate>
1111
<pubDate>Sat, 4 Jan 2020 19:15:54 -0500</pubDate>
1212
<atom:link href="https://cosmicpython.com/rss.xml" rel="self" type="application/rss+xml" />
13-
{% for item in posts %}
13+
{% for post in posts %}
1414
<item>
15-
<title>{{ item.title }}</title>
15+
<title>{{ post.title }}</title>
1616
<description>
17-
{{item.blog_subheading}}
17+
{{post.description}}
1818
</description>
19-
<link>{{item.link}}</link>
20-
<pubDate>{{item.rfc2822_date}}</pubDate>
21-
<dc:creator>{{ item.author }}</dc:creator>
22-
<guid>{{item.link}}</guid>
19+
<link>https://www.cosmicpython.com{{post.url}}</link>
20+
<pubDate>{{post.rfc2822_date}}</pubDate>
21+
<dc:creator>{{ post.author }}</dc:creator>
22+
<guid>{{post.link}}</guid>
2323
</item>
2424
{% endfor %}
2525
</channel>

0 commit comments

Comments
 (0)