Zur Illustration der CentOS-Installation benötige ich eine Fotogallerie in
meiner Octopress-Installation. In diesem Artikel beschreibe ich das
Vorgehen.
Neues Plugin: octopress-gallery
Ich verwende das Plugin Octopress-Gallery
zur Anzeige der Fotogallerie.
Vorbereitungen
Pfad zur Octopress-Installation: OP=/home/UliHeller/octopress
diff --git a/plugins/gallery_tag.rb b/plugins/gallery_tag.rbindex 6dc0c14..b2d8037 100644--- a/plugins/gallery_tag.rb+++ b/plugins/gallery_tag.rb@@ -4,14 +4,20 @@ module ImageList def image_list( name )
unless name == nil
list = Array.new
+ list << %Q{<script src="/javascripts/fotorama/jquery-1.10.2.min.js"></script>}+ list << %Q{<link href="/javascripts/fotorama/fotorama.css" rel="stylesheet">}+ list << %Q{<script src="/javascripts/fotorama/fotorama.js"></script>}+ list << %Q{<div class="fotorama" data-autoplay="3000" data-transition="dissolve" data-nav="thumbs" data-allow-full-screen="true" data-keyboard="true" data-w dir = Dir.new( File.join(BASE_DIR, name) )
- dir.each do | d |+ dir.sort.each do | d | image = File.basename(d, File.extname(d))
unless d =~ /^\./ || d =~ /thumbs/
- list << %Q{<a href="/images/galleries/#{name}/#{d}" rel="shadowbox" title="#{image}"><img src="/images/galleries/#{name}/thumbs/#{d}" /></a>}+# list << %Q{<a href="/images/galleries/#{name}/#{d}" rel="shadowbox" title="#{image}"><img src="/images/galleries/#{name}/thumbs/#{d}" /></a>}+ list << %Q{<a href="/images/galleries/#{name}/#{d}"><img src="/images/galleries/#{name}/thumbs/#{d}"/></a>} end
end
- list.sort.join( "\n" )+ list << %Q{</div> <!--class="fotorama" data-nav="thumbs" -->}+# list.sort.join( "\n" ) end
end
end
Probleme
Liquid Exception: no implicit conversion of nil into String in atom.xml
Die Ausführung von rake generate bricht ab mit einer Fehlermeldung:
12345678910
$ rake generate
## Generating Site with Jekyll
unchanged sass/print.scss
identical source/stylesheets/screen.css
Configuration from .../dp-octopress/_config.yml
Building site: source -> public
Liquid Exception: no implicit conversion of nil into String in atom.xml
.../dp-octopress/plugins/gallery_tag.rb:10:in `join'
.../dp-octopress/plugins/gallery_tag.rb:10:in `image_list'
...
Abhilfe: Anpassungen an plugins/gallery_tag.rb vornehmen:
Anpassungen an plugins/gallery_tag.rb
12345678910111213141516171819
diff --git a/plugins/gallery_tag.rb b/plugins/gallery_tag.rbindex f895040..6dc0c14 100644--- a/plugins/gallery_tag.rb+++ b/plugins/gallery_tag.rb@@ -2,6 +2,7 @@ BASE_DIR = 'source/images/galleries' module ImageList
def image_list( name )
+ unless name == nil list = Array.new
dir = Dir.new( File.join(BASE_DIR, name) )
dir.each do | d |
@@ -11,6 +12,7 @@ module ImageList end
end
list.sort.join( "\n" )
+ end end
end