Sha256: e4fd09bf6f860561899365b255dcd54f63ac4441789744e7aee6bfe980935b8a
Contents?: true
Size: 1.16 KB
Versions: 4
Compression:
Stored size: 1.16 KB
Contents
module Locomotive::Steam module Middlewares class Renderer < ThreadSafe include Concerns::Helpers include Concerns::LiquidContext def _call if page render_page else render_missing_404 end end private def render_page if page.redirect? redirect_to(page.redirect_url, page.redirect_type) else content = parse_and_render_liquid render_response(content, page.not_found? ? 404 : 200, page.response_type) end end def render_missing_404 message = (if locale != default_locale "Your 404 page is missing in the #{locale} locale." else "Your 404 page is missing." end) + " Please create it." log "[Warning] #{message}".red render_response(message, 404) end def parse_and_render_liquid document = services.liquid_parser.parse(page) begin document.render(liquid_context) rescue Locomotive::Steam::ParsingRenderingError => e e.file = page.template_path if e.file.blank? raise e end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems