summaryrefslogtreecommitdiffstats
path: root/nikola/plugins/task/pages.py
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@unit193.net>2021-02-03 19:17:00 -0500
committerLibravatarUnit 193 <unit193@unit193.net>2021-02-03 19:17:00 -0500
commit3a0d66f07b112b6d2bdc2b57bbf717a89a351ce6 (patch)
treea7cf56282e54f05785243bc1e903d6594f2c06ba /nikola/plugins/task/pages.py
parent787b97a4cb24330b36f11297c6d3a7a473a907d0 (diff)
New upstream version 8.1.2.upstream/8.1.2
Diffstat (limited to 'nikola/plugins/task/pages.py')
-rw-r--r--nikola/plugins/task/pages.py23
1 files changed, 18 insertions, 5 deletions
diff --git a/nikola/plugins/task/pages.py b/nikola/plugins/task/pages.py
index e6a8a82..0c0bdd2 100644
--- a/nikola/plugins/task/pages.py
+++ b/nikola/plugins/task/pages.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2015 Roberto Alsina and others.
+# Copyright © 2012-2020 Roberto Alsina and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
@@ -26,13 +26,13 @@
"""Render pages into output."""
-from __future__ import unicode_literals
+import os
+
from nikola.plugin_categories import Task
-from nikola.utils import config_changed
+from nikola.utils import config_changed, LOGGER
class RenderPages(Task):
-
"""Render pages into output."""
name = "render_pages"
@@ -48,6 +48,13 @@ class RenderPages(Task):
}
self.site.scan_posts()
yield self.group_task()
+ index_paths = {}
+ for lang in kw["translations"]:
+ index_paths[lang] = False
+ if not self.site.config["DISABLE_INDEXES"]:
+ index_paths[lang] = os.path.normpath(os.path.join(self.site.config['OUTPUT_FOLDER'],
+ self.site.path('index', '', lang=lang)))
+
for lang in kw["translations"]:
for post in self.site.timeline:
if not kw["show_untranslated_posts"] and not post.is_translation_available(lang):
@@ -55,8 +62,14 @@ class RenderPages(Task):
if post.is_post:
context = {'pagekind': ['post_page']}
else:
- context = {'pagekind': ['story_page']}
+ context = {'pagekind': ['story_page', 'page_page']}
for task in self.site.generic_page_renderer(lang, post, kw["filters"], context):
+ if task['name'] == index_paths[lang]:
+ # Issue 3022
+ LOGGER.error(
+ "Post {0!r}: output path ({1}) conflicts with the blog index ({2}). "
+ "Please change INDEX_PATH or disable index generation.".format(
+ post.source_path, task['name'], index_paths[lang]))
task['uptodate'] = task['uptodate'] + [config_changed(kw, 'nikola.plugins.task.pages')]
task['basename'] = self.name
task['task_dep'] = ['render_posts']