Class: Aardi::JSONFeed

Inherits:
AbstractFeed show all
Defined in:
lib/aardi/json_feed.rb

Instance Attribute Summary

Attributes inherited from AbstractBlog

#key

Instance Method Summary collapse

Methods inherited from AbstractFeed

#initialize, #render, #target_path

Methods inherited from AbstractBlog

#metadata, #mtime, #render

Constructor Details

This class inherits a constructor from Aardi::AbstractFeed

Instance Method Details

#contentObject



5
6
7
8
9
10
11
12
# File 'lib/aardi/json_feed.rb', line 5

def content
  aardi_config = Aardi.config
  feed_content = { version: 'https://jsonfeed.org/version/1.1', title: aardi_config[:site_title],
                   home_page_url: aardi_config[:site_url], feed_url: }
  feed_content[:items] = @posts.map { |post| post_details(post) }

  JSON.pretty_generate(feed_content)
end