RSS
This commit is contained in:
parent
0964db995e
commit
9b0fb75043
5 changed files with 10 additions and 6 deletions
|
@ -1,12 +1,10 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<rss version="2.0">
|
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||||
|
|
||||||
<channel>
|
<channel>
|
||||||
<title>{{ title }}</title>
|
<title>{{ title }}</title>
|
||||||
<link>{{ site_url }}/</link>
|
<link>{{ site_url }}/</link>
|
||||||
<description>{{ subtitle }}</description>
|
<description>{{ subtitle }}</description>
|
||||||
|
<atom:link href="{{ site_url}}/rss.xml" rel="self" type="application/rss+xml" />
|
||||||
{{ content }}
|
{{ content }}
|
||||||
|
|
||||||
</channel>
|
</channel>
|
||||||
</rss>
|
</rss>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
<item>
|
<item>
|
||||||
|
<guid>{{ site_url }}/{{ year }}/{{ slug }}.html</guid>
|
||||||
<title>{{ title }}</title>
|
<title>{{ title }}</title>
|
||||||
<link>{{ site_url }}/{{ year }}/{{ slug }}.html</link>
|
<link>{{ site_url }}/{{ year }}/{{ slug }}.html</link>
|
||||||
<description>
|
<description>
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||||
{{ content }}
|
{{ content }}
|
||||||
|
</urlset>
|
|
@ -1,4 +1,4 @@
|
||||||
<url>
|
<url>
|
||||||
<loc>{{ site_url }}/{{ date }}/{{ slug }}.html</loc>
|
<loc>{{ site_url }}/{{ date }}/{{ slug }}.html</loc>
|
||||||
<lastmod>{{ rfc_2822_date }}</lastmod>
|
<lastmod>{{ date }}</lastmod>
|
||||||
</url>
|
</url>
|
||||||
|
|
|
@ -34,6 +34,8 @@ import glob
|
||||||
import sys
|
import sys
|
||||||
import json
|
import json
|
||||||
import datetime
|
import datetime
|
||||||
|
import time
|
||||||
|
from email import utils
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import unicodedata
|
import unicodedata
|
||||||
import locale
|
import locale
|
||||||
|
@ -78,7 +80,9 @@ def read_headers(text):
|
||||||
def rfc_2822_format(date_str):
|
def rfc_2822_format(date_str):
|
||||||
"""Convert yyyy-mm-dd date string to RFC 2822 format date string."""
|
"""Convert yyyy-mm-dd date string to RFC 2822 format date string."""
|
||||||
d = datetime.datetime.strptime(date_str, '%Y-%m-%d')
|
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):
|
def slugify(value):
|
||||||
|
|
Loading…
Add table
Reference in a new issue