Sha256: d57d1fb852d0a973dd7676470304075c7492cff732182c4262dd5cd35f014415
Contents?: true
Size: 1.07 KB
Versions: 8
Compression:
Stored size: 1.07 KB
Contents
module Plate # A static page is left unmodified and is transferred over to the published # site exactly as it is. class StaticPage < Page def file_path base = Pathname.new(File.join(self.site.source, 'content')) current = Pathname.new(self.file) dirs = current.relative_path_from(base) "/#{dirs}" end def layout nil end # If we need for some reason, read this file's contents def rendered_content @rendered_content ||= File.read(self.file) end # Check a static page to see if it should be converted into a Page def upgrade? rendered_content.start_with?('---') end # Write this page to the destination. For static files this just results # in copying the file over to the destination def write! path = File.join(site.build_destination, file_path) FileUtils.mkdir_p(File.dirname(path)) FileUtils.cp(self.file, path) end protected # Don't read any meta data for static files, leave them as-is. def read_metadata! self.meta = {} end end end
Version data entries
8 entries across 8 versions & 1 rubygems