class Jekyll::Site
Add helper methods for dealing with Strapi
to the Site
class
Public Instance Methods
endpoint()
click to toggle source
# File lib/jekyll/strapi/site.rb, line 21 def endpoint has_strapi? and @config['strapi']['endpoint'] or "http://localhost:1337" end
has_strapi?()
click to toggle source
# File lib/jekyll/strapi/site.rb, line 13 def has_strapi? @config['strapi'] != nil end
has_strapi_collections?()
click to toggle source
# File lib/jekyll/strapi/site.rb, line 17 def has_strapi_collections? has_strapi? and @config['strapi']['collections'] != nil end
strapi()
click to toggle source
# File lib/jekyll/strapi/site.rb, line 4 def strapi return nil unless has_strapi? end
strapi_collection(collection_name)
click to toggle source
# File lib/jekyll/strapi/site.rb, line 41 def strapi_collection(collection_name) strapi_collections[collection_name] end
strapi_collections()
click to toggle source
# File lib/jekyll/strapi/site.rb, line 8 def strapi_collections return Array.new unless has_strapi_collections? @strapi_collections ||= Hash[@config['strapi']['collections'].map {|name, config| [name, Strapi::StrapiCollection.new(self, name, config)]}] end
strapi_link_resolver(collection = nil, document = nil)
click to toggle source
# File lib/jekyll/strapi/site.rb, line 25 def strapi_link_resolver(collection = nil, document = nil) return "/" unless collection != nil and @config['strapi']['collections'][collection]['permalink'] != nil url = Jekyll::URL.new( :template => @config['strapi']['collections'][collection]['permalink'], :placeholders => { :id => document.id.to_s, :uid => document.uid, :slug => document.slug, :type => document.type } ) url.to_s end