sitemap
This commit is contained in:
parent
f8ddfb09e2
commit
d18e556f2d
4 changed files with 13 additions and 2 deletions
2
layout/sitemap.xml
Normal file
2
layout/sitemap.xml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
<?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">
|
4
layout/sitemap_item.xml
Normal file
4
layout/sitemap_item.xml
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
<url>
|
||||||
|
<loc>{{ site_url }}/{{ date }}/{{ slug }}.html</loc>
|
||||||
|
<lastmod>{{ rfc_2822_date }}</lastmod>
|
||||||
|
</url>
|
|
@ -287,7 +287,9 @@ def main():
|
||||||
banner_layout = fread('layout/banner.html')
|
banner_layout = fread('layout/banner.html')
|
||||||
category_layout = fread('layout/category.html')
|
category_layout = fread('layout/category.html')
|
||||||
rss_xml = fread('layout/rss.xml')
|
rss_xml = fread('layout/rss.xml')
|
||||||
item_xml = fread('layout/item.xml')
|
rss_item_xml = fread('layout/rss_item.xml')
|
||||||
|
sitemap_xml = fread('layout/sitemap.xml')
|
||||||
|
sitemap_item_xml = fread('layout/sitemap_item.xml')
|
||||||
|
|
||||||
# Combine layouts to form final layouts.
|
# Combine layouts to form final layouts.
|
||||||
post_layout = render(page_layout, content=post_layout)
|
post_layout = render(page_layout, content=post_layout)
|
||||||
|
@ -325,8 +327,11 @@ def main():
|
||||||
# Create RSS feeds.
|
# Create RSS feeds.
|
||||||
nb_items = min(10, len(blog_posts))
|
nb_items = min(10, len(blog_posts))
|
||||||
make_list(blog_posts[:nb_items], '_site/rss.xml',
|
make_list(blog_posts[:nb_items], '_site/rss.xml',
|
||||||
rss_xml, item_xml, None, **params)
|
rss_xml, rss_item_xml, None, **params)
|
||||||
|
|
||||||
|
# Create sitemap
|
||||||
|
make_list(blog_posts, '_site/sitemap.xml',
|
||||||
|
sitemap_xml, sitemap_item_xml, None, **params)
|
||||||
|
|
||||||
# Test parameter to be set temporarily by unit tests.
|
# Test parameter to be set temporarily by unit tests.
|
||||||
_test = None
|
_test = None
|
||||||
|
|
Loading…
Add table
Reference in a new issue