Skip to content

Commit

Permalink
Also sort RSS feed correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
ralsina committed Oct 31, 2015
1 parent 2a09ede commit 62578db
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions nikola/plugins/task/galleries.py
Expand Up @@ -596,6 +596,19 @@ def gallery_rss(self, img_list, dest_img_list, img_titles, lang, permalink, outp
def make_url(url):
return urljoin(self.site.config['BASE_URL'], url.lstrip('/'))

all_data = list(zip(img_list, dest_img_list, img_titles))

if self.kw['sort_by_date']:
all_data.sort(key=lambda a: self.image_date(a[0]))
else: # Sort by name
all_data.sort(key=lambda a: a[0])

if all_data:
img_list, dest_img_list, img_titles = zip(*all_data)
else:
img_list, dest_img_list, img_titles = [], [], []


items = []
for img, srcimg, title in list(zip(dest_img_list, img_list, img_titles))[:self.kw["feed_length"]]:
img_size = os.stat(
Expand Down

0 comments on commit 62578db

Please sign in to comment.