Use file's initial commit ID as part of RSS item guid.

This commit is contained in:
Ethan Dalool 2020-11-01 01:44:54 -07:00
parent a7959e0b0f
commit 76b36ca509

View file

@ -194,6 +194,8 @@ class Article:
github_history = f'https://github.com/voussoir/voussoir.net/commits/master/{relative_path}' github_history = f'https://github.com/voussoir/voussoir.net/commits/master/{relative_path}'
commits = git_file_commit_history(self.md_file) commits = git_file_commit_history(self.md_file)
self.publication_id = f'{commits[-1][0]}/{self.web_path}' if commits else None
commits = [ commits = [
f'- [{html.escape(line)}](https://github.com/voussoir/voussoir.net/commit/{hash})' f'- [{html.escape(line)}](https://github.com/voussoir/voussoir.net/commit/{hash})'
for (hash, line) in commits for (hash, line) in commits
@ -454,6 +456,7 @@ def write_rss():
{% for article in articles %} {% for article in articles %}
<item> <item>
<title>{{article.title|e}}</title> <title>{{article.title|e}}</title>
<guid isPermalink="false">{{article.publication_id}}</guid>
<link>https://voussoir.net/writing/{{article.web_path}}</link> <link>https://voussoir.net/writing/{{article.web_path}}</link>
<pubDate>{{article.date}}</pubDate> <pubDate>{{article.date}}</pubDate>
<description> <description>
@ -465,7 +468,7 @@ def write_rss():
{% endfor %} {% endfor %}
</channel> </channel>
</rss> </rss>
'''.strip()).render(articles=sorted(ARTICLES.values(), key=lambda a: a.date, reverse=True)) '''.strip()).render(articles=sorted(ARTICLES_PUBLISHED.values(), key=lambda a: a.date, reverse=True))
write(WRITING_ROOTDIR.with_child('rss.xml'), rss) write(WRITING_ROOTDIR.with_child('rss.xml'), rss)
# GO # GO
@ -476,6 +479,8 @@ ARTICLES = {
if file.extension == 'md' and file.parent != WRITING_ROOTDIR if file.extension == 'md' and file.parent != WRITING_ROOTDIR
} }
ARTICLES_PUBLISHED = {file: article for (file, article) in ARTICLES.items() if article.publication_id}
write_articles() write_articles()
complete_tag_index = Index() complete_tag_index = Index()
all_tags = set(P.get_tags()) all_tags = set(P.get_tags())