Pass the rss validator

This commit is contained in:
2026-10-31 02:09:21 +01:00
parent 689c142d2e
commit 73e3b67df2
3 changed files with 6 additions and 8 deletions
+2 -4
View File
@@ -5,20 +5,18 @@
xmlns:atom="http://www.w3.org/2005/Atom" xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"> xmlns:slash="http://purl.org/rss/1.0/modules/slash/">
<atom:link href="https://{{base_url}}]/blog/{%if user %}{{ user }}/{% endif %}rss.xml" rel="self" type="application/rss+xml" />
<channel> <channel>
<title> Le blog de {{ blog_name }} </title> <title> Le blog de {{ blog_name }} </title>
<link> {{ base_url }}/blog/ </link> <link> {{ base_url }}/blog/ </link>
{% if blog_description %}
<description> {{ blog_description }} </description> <description> {{ blog_description }} </description>
{% endif %}
<language>fr</language> <language>fr</language>
<atom:link href="{{base_url}}blog/{%if user %}{{ user }}/{% endif %}rss.xml" rel="self" type="application/rss+xml" />
{% for post in posts %} {% for post in posts %}
<item> <item>
<title> {{ post.title }} </title> <title> {{ post.title }} </title>
<pubDate> {% if post.last_updated %} {{ post.last_updated }} {% else %} {{ post.creation_date }} {% endif %} </pubDate> <pubDate>{% if post.last_updated %}{{ post.last_updated }}{% else %}{{ post.creation_date }}{% endif %}</pubDate>
<link> {{base_url}}/{{ url_for('blog.viewArticle', username=post.author, title_id=post.title_id) }}</link> <link> {{base_url}}/{{ url_for('blog.viewArticle', username=post.author, title_id=post.title_id) }}</link>
<guid> {{base_url}}/{{ url_for('blog.viewArticle', username=post.author, title_id=post.title_id) }} </guid> <guid> {{base_url}}/{{ url_for('blog.viewArticle', username=post.author, title_id=post.title_id) }} </guid>
+2 -2
View File
@@ -25,7 +25,7 @@ for post in list_posts:
try: try:
date_post = time.strptime(post[1], '%d/%m/%Y %H:%M:%S') date_post = time.strptime(post[1], '%d/%m/%Y %H:%M:%S')
except: except:
print(title +'-- Posted at: '+ post[1] + ' Not modified: The date is not in the old format') print(title +'-- Posted at: '+ str(post[1]) + ' Not modified: The date is not in the old format')
newDatePost = post[1] newDatePost = post[1]
else: else:
newDatePost = time.strftime("%Y-%m-%d %H:%M:%S", date_post) newDatePost = time.strftime("%Y-%m-%d %H:%M:%S", date_post)
@@ -33,7 +33,7 @@ for post in list_posts:
try: try:
last_updated_post = time.strptime(post[2], '%d/%m/%Y %H:%M:%S') last_updated_post = time.strptime(post[2], '%d/%m/%Y %H:%M:%S')
except: except:
print(title + '-- Updated at '+ post[2] + ' Not modified: The date is not in the old format') print(title + '-- Updated at '+ str(post[2]) + ' Not modified: The date is not in the old format')
newDateUpdatedPost = post[2] newDateUpdatedPost = post[2]
else: else:
newDateUpdatedPost = time.strftime("%Y-%m-%d %H:%M:%S", last_updated_post) newDateUpdatedPost = time.strftime("%Y-%m-%d %H:%M:%S", last_updated_post)
+2 -2
View File
@@ -302,7 +302,7 @@ def viewauthorrss(author):
# Build date to RFC822 format # Build date to RFC822 format
date_post = time.strptime(post[4], "%Y-%m-%d %H:%M:%S") date_post = time.strptime(post[4], "%Y-%m-%d %H:%M:%S")
posts=[dict(title_id=post[0], title=post[1], subtitle=post[2], content=markdown(post[3], extensions=MARKDOWN_EXT), posts=[dict(title_id=post[0], title=post[1], subtitle=post[2], content=markdown(post[3], extensions=MARKDOWN_EXT),
creation_date=time.strftime("%a, %d %b %Y %H:%M:%S", date_post) + time.strftime(' %Z'), creation_date=time.strftime("%a, %d %b %Y %H:%M:%S", date_post) + time.strftime(' %z'),
author=post[5], status=post[6])] + posts author=post[5], status=post[6])] + posts
resp = make_response(render_template('blog_rss.xml', resp = make_response(render_template('blog_rss.xml',
@@ -371,7 +371,7 @@ def viewrss():
# Build date to RFC822 format # Build date to RFC822 format
date_post = time.strptime(post[4], "%Y-%m-%d %H:%M:%S") date_post = time.strptime(post[4], "%Y-%m-%d %H:%M:%S")
posts=[dict(title_id=post[0], title=post[1], subtitle=post[2], content=markdown(post[3], extensions=MARKDOWN_EXT), posts=[dict(title_id=post[0], title=post[1], subtitle=post[2], content=markdown(post[3], extensions=MARKDOWN_EXT),
creation_date=time.strftime("%a, %d %b %Y %H:%M:%S", date_post) + time.strftime(' %Z'), creation_date=time.strftime("%a, %d %b %Y %H:%M:%S", date_post) + time.strftime(' %z'),
author=post[5], status=post[6])] + posts author=post[5], status=post[6])] + posts
resp = make_response(render_template('blog_rss.xml', resp = make_response(render_template('blog_rss.xml',