Browse Source

Feeds: fix links to gallery and image, ref #361

pull/363/head
Simon Conseil 7 years ago
parent
commit
af67de6ee5
  1. 11
      sigal/plugins/feeds.py
  2. 4
      tests/sample/sigal.conf.py

11
sigal/plugins/feeds.py

@ -51,17 +51,24 @@ def generate_feed(gallery, medias, feed_type=None, feed_url='', nb_items=0):
description=Markup.escape(root_album.description).striptags()
)
theme = gallery.settings['theme']
nb_medias = len(medias)
nb_items = min(nb_items, nb_medias) if nb_items > 0 else nb_medias
for item in medias[:nb_items]:
if theme == 'galleria':
link = '%s/%s/#%s' % (feed_url, item.path, item.url)
else:
link = '%s/%s/' % (feed_url, item.path)
feed.add_item(
title=Markup.escape(item.title or item.url),
link='%s/#%s' % (item.path, item.url),
link=link,
# unique_id='tag:%s,%s:%s' % (urlparse(link).netloc,
# item.date.date(),
# urlparse(link).path.lstrip('/')),
description='<img src="%s/%s" />' % (item.path, item.thumbnail),
description='<img src="%s/%s/%s" />' % (feed_url, item.path,
item.thumbnail),
# categories=item.tags if hasattr(item, 'tags') else None,
author_name=getattr(item, 'author', ''),
pubdate=item.date or datetime.now(),

4
tests/sample/sigal.conf.py

@ -22,8 +22,8 @@ watermark_opacity = 0.3
theme = 'colorbox'
thumb_size = (200, 150)
rss_feed = {'feed_url': 'http://example.org/feed.rss', 'nb_items': 10}
atom_feed = {'feed_url': 'http://example.org/feed.atom', 'nb_items': 10}
rss_feed = {'feed_url': 'http://127.0.0.1:8000/feed.rss', 'nb_items': 10}
atom_feed = {'feed_url': 'http://127.0.0.1:8000/feed.atom', 'nb_items': 10}
# theme = 'photoswipe'
# theme = 'galleria'

Loading…
Cancel
Save