Skip to content

Commit

Permalink
Use rel=self link for main RSS feed
Browse files Browse the repository at this point in the history
  • Loading branch information
ralsina committed Sep 2, 2013
1 parent 2254086 commit b3c329c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
3 changes: 3 additions & 0 deletions nikola/nikola.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,9 @@ def __init__(self, **config):
# BASE_URL defaults to SITE_URL
if 'BASE_URL' not in self.config:
self.config['BASE_URL'] = self.config.get('SITE_URL')
# BASE_URL should *always* end in /
if self.config['BASE_URL'] and self.config['BASE_URL'][-1] != '/':
print("WARNING: Your BASE_URL doesn't end in / -- adding it.")

self.plugin_manager = PluginManager(categories_filter={
"Command": Command,
Expand Down
2 changes: 1 addition & 1 deletion nikola/plugins/command/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class CommandInit(Command):
SAMPLE_CONF = {
'BLOG_AUTHOR': "Your Name",
'BLOG_TITLE': "Demo Site",
'SITE_URL': "http://nikola.ralsina.com.ar",
'SITE_URL': "http://nikola.ralsina.com.ar/",
'BLOG_EMAIL': "joe@demo.site",
'BLOG_DESCRIPTION': "This is a demo site for Nikola.",
'DEFAULT_LANG': "en",
Expand Down
10 changes: 9 additions & 1 deletion nikola/plugins/task/rss.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,17 @@
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

from __future__ import unicode_literals, print_function
import os

from nikola import utils
from nikola.plugin_categories import Task

try:
from urlparse import urljoin
except ImportError:
from urllib.parse import urljoin # NOQA


class RenderRSS(Task):
"""Generate RSS feeds."""
Expand Down Expand Up @@ -60,6 +66,8 @@ def gen_tasks(self):
posts = [x for x in self.site.timeline if x.use_in_feeds][:10]
for post in posts:
deps += post.deps(lang)

feed_url = urljoin(self.site.config['BASE_URL'], self.site.link("rss", None, lang).lstrip('/'))
yield {
'basename': 'render_rss',
'name': os.path.normpath(output_name),
Expand All @@ -68,7 +76,7 @@ def gen_tasks(self):
'actions': [(utils.generic_rss_renderer,
(lang, kw["blog_title"], kw["site_url"],
kw["blog_description"], posts, output_name,
kw["rss_teasers"], kw['feed_length']))],
kw["rss_teasers"], kw['feed_length'], feed_url))],
'task_dep': ['render_posts'],
'clean': True,
'uptodate': [utils.config_changed(kw)],
Expand Down

0 comments on commit b3c329c

Please sign in to comment.