Class: Jekyll::PhotoPost
- Inherits:
-
Post
- Object
- Post
- Jekyll::PhotoPost
- Defined in:
- lib/badpixxel-jekyll-flickr.rb
Instance Method Summary collapse
-
#initialize(site, base, dir, photo) ⇒ PhotoPost
constructor
A new instance of PhotoPost.
Constructor Details
#initialize(site, base, dir, photo) ⇒ PhotoPost
Returns a new instance of PhotoPost.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/badpixxel-jekyll-flickr.rb', line 41 def initialize(site, base, dir, photo) name = photo.date[0..9] + '-photo-' + photo.slug + '.md' data = Hash.new data['title'] = photo.title data['shorttitle'] = photo.title data['description'] = photo.description data['date'] = photo.date data['slug'] = photo.slug data['permalink'] = File.join('/archives', photo.slug, 'index.html') data['flickr'] = Hash.new data['flickr']['id'] = photo.id data['flickr']['url_full'] = photo.url_full data['flickr']['url_thumb'] = photo.url_thumb if site.config['flickr']['generate_frontmatter'] site.config['flickr']['generate_frontmatter'].each do |key, value| data[key] = value end end File.open(File.join('_posts', name), 'w') {|f| f.print(YAML::dump(data)) f.print("---\n\n") f.print(photo.gen_full_html) } super(site, base, dir, name) end |