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"?>
|
||||
<rss version="2.0">
|
||||
|
||||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<channel>
|
||||
<title>{{ title }}</title>
|
||||
<link>{{ site_url }}/</link>
|
||||
<description>{{ subtitle }}</description>
|
||||
|
||||
<atom:link href="{{ site_url}}/rss.xml" rel="self" type="application/rss+xml" />
|
||||
{{ content }}
|
||||
|
||||
</channel>
|
||||
</rss>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<item>
|
||||
<guid>{{ site_url }}/{{ year }}/{{ slug }}.html</guid>
|
||||
<title>{{ title }}</title>
|
||||
<link>{{ site_url }}/{{ year }}/{{ slug }}.html</link>
|
||||
<description>
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
<?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">
|
||||
{{ content }}
|
||||
</urlset>
|
|
@ -1,4 +1,4 @@
|
|||
<url>
|
||||
<loc>{{ site_url }}/{{ date }}/{{ slug }}.html</loc>
|
||||
<lastmod>{{ rfc_2822_date }}</lastmod>
|
||||
<lastmod>{{ date }}</lastmod>
|
||||
</url>
|
||||
|
|
|
@ -34,6 +34,8 @@ import glob
|
|||
import sys
|
||||
import json
|
||||
import datetime
|
||||
import time
|
||||
from email import utils
|
||||
from pathlib import Path
|
||||
import unicodedata
|
||||
import locale
|
||||
|
@ -78,7 +80,9 @@ def read_headers(text):
|
|||
def rfc_2822_format(date_str):
|
||||
"""Convert yyyy-mm-dd date string to RFC 2822 format date string."""
|
||||
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):
|
||||
|
|
Loading…
Add table
Reference in a new issue