update wiki descriptive title

This commit is contained in:
Bhupesh-V 2024-01-01 19:26:46 +05:30
parent 0060d1aeed
commit 753567f319

View File

@ -61,13 +61,13 @@ def update_wiki(reddit, wikipage, posts):
wiki_header = """# A collection of must read discussions started by community members""" wiki_header = """# A collection of must read discussions started by community members"""
content = wiki_header + "\n\n" content = wiki_header + "\n\n"
content += f"A handpicked collection of **{total_posts}** quality threads across {total_years} years.\n\n" content += f"A handpicked collection of **{total_posts}** interesting posts, discusions & high-quality threads gathered over a {total_years} year period.\n\n"
for year in sorted(posts_by_year.keys(), reverse=True): for year in sorted(posts_by_year.keys(), reverse=True):
content += f"## {year}\n\n" content += f"## {year}\n\n"
# Add the posts for this year # Add the posts for this year
for post in posts_by_year[year]: for post in posts_by_year[year]:
formatted_date = datetime.strptime(post['created_at'], '%Y-%m-%dT%H:%M:%S').strftime('%d-%m-%Y') formatted_date = datetime.strptime(post['created_at'], '%Y-%m-%dT%H:%M:%S').strftime('%d %b, %Y')
content += f"- `{formatted_date}` [`{post['title']}`]({post['url']})\n\n" content += f"- `{formatted_date}` [`{post['title']}`]({post['url']})\n\n"
# given a wiki link, update the wiki page with new markdown # given a wiki link, update the wiki page with new markdown