class Jekyll::AmpPost
Defines the base class of AMP posts
Public Class Methods
new(site, base, dir, post)
click to toggle source
# File lib/jekyll/amp_generate.rb, line 4 def initialize(site, base, dir, post) @site = site @base = base @dir = dir # Needed for posts with permalink @url = dir @name = 'index.html' self.process(@name) self.read_yaml(File.join(base, '_layouts'), 'amp.html') self.content = post.content self.data['body'] = (Liquid::Template.parse post.content).render site.site_payload # Merge all data from post so that keys from self.data have higher priority self.data = post.data.merge(self.data) # Remove non needed keys from data # Excerpt will cause an error if kept self.data.delete('excerpt') # Generating the page fails silently if page has a permalink and it is copied # over to the AMP version self.data.delete('permalink') self.data['canonical_url'] = post.url end