Add rss for recursive galleries
This commit is contained in:
parent
5a8f172480
commit
c0e7807cfa
@ -324,6 +324,7 @@ def build_gallery(gallery, settings, templates, parent_galleries=False):
|
||||
)
|
||||
|
||||
build_index(settings, sub_page_galleries_cover, subgallery_templates, gallery_path)
|
||||
gallery_cover['sub_gallery'] = sub_page_galleries_cover
|
||||
return gallery_cover
|
||||
|
||||
# this should probably be a factory
|
||||
@ -403,7 +404,7 @@ def main():
|
||||
"themes", "exposure", "templates"))
|
||||
|
||||
templates = Environment(loader=FileSystemLoader(templates_dir))
|
||||
|
||||
templates.add_extension('jinja2.ext.with_')
|
||||
feed_template = templates.get_template("feed.xml")
|
||||
|
||||
# XXX recursively merge directories
|
||||
@ -424,7 +425,7 @@ def main():
|
||||
|
||||
feed_xml.write(feed_template.render(
|
||||
settings=settings,
|
||||
galleries=reversed(sorted(front_page_galleries_cover, key=lambda x: x["date"]))
|
||||
galleries=reversed(sorted(filter(lambda x: x != {}, front_page_galleries_cover), key=lambda x: x["date"]))
|
||||
).encode("Utf-8"))
|
||||
|
||||
build_index(settings, front_page_galleries_cover, templates)
|
||||
|
@ -5,19 +5,9 @@
|
||||
<description>{{ settings.sub_title }}</description>
|
||||
<link>{{ settings.url }}</link>
|
||||
<atom:link href="{{ settings.url }}/feed.xml" rel="self" type="application/rss+xml" />
|
||||
|
||||
{% for gallery in galleries %}
|
||||
{% set absolute_url = settings.url + "/" + gallery.link -%}
|
||||
<item>
|
||||
<title>{{ gallery.title }}</title>
|
||||
<link>{{ absolute_url }}</link>
|
||||
<guid>{{ gallery.link }}</guid>
|
||||
{% if gallery.sub_title -%}
|
||||
<description>{{ gallery.sub_title }}</description>
|
||||
{% endif -%}
|
||||
<pubDate>{{ gallery.date }}</pubDate>
|
||||
</item>
|
||||
{% set absolute_url = settings.url + "/" %}
|
||||
{% include "item.html" %}
|
||||
{% endfor %}
|
||||
|
||||
</channel>
|
||||
</rss>
|
||||
|
16
prosopopee/themes/exposure/templates/item.html
Normal file
16
prosopopee/themes/exposure/templates/item.html
Normal file
@ -0,0 +1,16 @@
|
||||
{% set absolute_url = absolute_url+ gallery.link+"/" -%}
|
||||
<item>
|
||||
<title>{{ gallery.title }}</title>
|
||||
<link>{{ absolute_url }}</link>
|
||||
<guid>{{ gallery.link }}</guid>
|
||||
{% if gallery.sub_title -%}
|
||||
<description>{{ gallery.sub_title }}</description>
|
||||
{% endif -%}
|
||||
<pubDate>{{ gallery.date }}</pubDate>
|
||||
</item>
|
||||
{% for sub_gallery in gallery.sub_gallery %}
|
||||
{% with gallery=sub_gallery %}
|
||||
{% include "item.html" %}
|
||||
{% endwith %}
|
||||
{% endfor %}
|
||||
|
@ -5,19 +5,9 @@
|
||||
<description>{{ settings.sub_title }}</description>
|
||||
<link>{{ settings.url }}</link>
|
||||
<atom:link href="{{ settings.url }}/feed.xml" rel="self" type="application/rss+xml" />
|
||||
|
||||
{% for gallery in galleries %}
|
||||
{% set absolute_url = settings.url + "/" + gallery.link -%}
|
||||
<item>
|
||||
<title>{{ gallery.title }}</title>
|
||||
<link>{{ absolute_url }}</link>
|
||||
<guid>{{ gallery.link }}</guid>
|
||||
{% if gallery.sub_title -%}
|
||||
<description>{{ gallery.sub_title }}</description>
|
||||
{% endif -%}
|
||||
<pubDate>{{ gallery.date }}</pubDate>
|
||||
</item>
|
||||
{% set absolute_url = settings.url + "/" %}
|
||||
{% include "item.html" %}
|
||||
{% endfor %}
|
||||
|
||||
</channel>
|
||||
</rss>
|
||||
|
16
prosopopee/themes/material/templates/item.html
Normal file
16
prosopopee/themes/material/templates/item.html
Normal file
@ -0,0 +1,16 @@
|
||||
{% set absolute_url = absolute_url+ gallery.link+"/" -%}
|
||||
<item>
|
||||
<title>{{ gallery.title }}</title>
|
||||
<link>{{ absolute_url }}</link>
|
||||
<guid>{{ gallery.link }}</guid>
|
||||
{% if gallery.sub_title -%}
|
||||
<description>{{ gallery.sub_title }}</description>
|
||||
{% endif -%}
|
||||
<pubDate>{{ gallery.date }}</pubDate>
|
||||
</item>
|
||||
{% for sub_gallery in gallery.sub_gallery %}
|
||||
{% with gallery=sub_gallery %}
|
||||
{% include "item.html" %}
|
||||
{% endwith %}
|
||||
{% endfor %}
|
||||
|
Loading…
x
Reference in New Issue
Block a user