Skip to content
Permalink
Browse files

fix #1726 -- global gallery images

Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed May 16, 2015
1 parent 83c8254 commit aab26841991487f52cbfdabb5fa1ff94fc3ddfa1
Showing with 10 additions and 3 deletions.
  1. +2 −1 CHANGES.txt
  2. +8 −2 nikola/plugins/task/galleries.py
@@ -10,7 +10,8 @@ Features
Bugfixes
--------

* Exclude `<meta content="noindex" name="robots">` from sitemaps
* Use a global directory for gallery images, ignoring translations (Issue #1726)
* Exclude ``<meta content="noindex" name="robots">`` from sitemaps
* new_post paths are now relative to CWD (Issue #1325)

New in v7.4.1
@@ -66,6 +66,7 @@ class Galleries(Task, ImageProcessor):

def set_site(self, site):
site.register_path_handler('gallery', self.gallery_path)
site.register_path_handler('gallery_global', self.gallery_global_path)
site.register_path_handler('gallery_rss', self.gallery_rss_path)

self.logger = utils.get_logger('render_galleries', site.loghandlers)
@@ -126,6 +127,11 @@ def gallery_path(self, name, lang):
list(os.path.split(gallery_path)) +
[self.site.config['INDEX_FILE']] if _f]

def gallery_global_path(self, name, lang):
gallery_path = self._find_gallery_path(name)
return [_f for _f in list(os.path.split(gallery_path)) +
[self.site.config['INDEX_FILE']] if _f]

def gallery_rss_path(self, name, lang):
gallery_path = self._find_gallery_path(name)
return [_f for _f in [self.site.config['TRANSLATIONS'][lang]] +
@@ -429,7 +435,7 @@ def create_target_images(self, img, input_path):
output_gallery = os.path.dirname(
os.path.join(
self.kw["output_folder"],
self.site.path("gallery", gallery_name)))
self.site.path("gallery_global", gallery_name)))
# Do thumbnails and copy originals
# img is "galleries/name/image_name.jpg"
# img_name is "image_name.jpg"
@@ -481,7 +487,7 @@ def remove_excluded_image(self, img, input_folder):
output_folder = os.path.dirname(
os.path.join(
self.kw["output_folder"],
self.site.path("gallery", os.path.dirname(img))))
self.site.path("gallery_global", os.path.dirname(img))))
img = os.path.relpath(img, input_folder)
img_path = os.path.join(output_folder, os.path.basename(img))
fname, ext = os.path.splitext(img_path)

0 comments on commit aab2684

Please sign in to comment.