mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Fix #1039 ATOM feed for sites using https or a subdirectory
Fixes issue #1039. Atom feed is invalid when SITEURL has https or a subdirectory, for example: * https://myblog.com/ * http://mysite.com/blog
This commit is contained in:
parent
4d9197d139
commit
485a10c47e
1 changed files with 5 additions and 3 deletions
|
|
@ -5,6 +5,7 @@ import six
|
|||
import os
|
||||
import locale
|
||||
import logging
|
||||
from urlparse import urlparse
|
||||
|
||||
from codecs import open
|
||||
from feedgenerator import Atom1Feed, Rss201rev2Feed
|
||||
|
|
@ -35,11 +36,12 @@ class Writer(object):
|
|||
def _add_item_to_the_feed(self, feed, item):
|
||||
|
||||
title = Markup(item.title).striptags()
|
||||
link='%s/%s' % (self.site_url, item.url)
|
||||
feed.add_item(
|
||||
title=title,
|
||||
link='%s/%s' % (self.site_url, item.url),
|
||||
unique_id='tag:%s,%s:%s' % (self.site_url.replace('http://', ''),
|
||||
item.date.date(), item.url),
|
||||
link=link,
|
||||
unique_id='tag:%s,%s:%s' % (urlparse(link).netloc,
|
||||
item.date.date(), urlparse(link).path),
|
||||
description=item.get_content(self.site_url),
|
||||
categories=item.tags if hasattr(item, 'tags') else None,
|
||||
author_name=getattr(item, 'author', ''),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue