Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 aab2684
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
3 changes: 2 additions & 1 deletion CHANGES.txt
Expand Up @@ -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
Expand Down
10 changes: 8 additions & 2 deletions nikola/plugins/task/galleries.py
Expand Up @@ -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)
Expand Down Expand Up @@ -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]] +
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit aab2684

Please sign in to comment.