Sha256: 45f06a28195a2d16b0b2171b6934c4c25747d5261df0f4c0021f3b956b1159b6
Contents?: true
Size: 1013 Bytes
Versions: 10
Compression:
Stored size: 1013 Bytes
Contents
# frozen_string_literal: true module Maglev module RenderingConcern extend ActiveSupport::Concern included do include Maglev::FetchersConcern end private def render_maglev_page fetch_maglev_page_content verify_canonical_path and return render template: fetch_maglev_theme_layout, layout: false end def verify_canonical_path # the section mode is only used to display the content of a single section # in the admin UI. return if maglev_rendering_mode == :section # check if we're processing the right version (canonical) of the page # if not, follow the proper SEO rule by redirecting the user with a 301 canonical_path = maglev_page.path return false if !canonical_path || params[:path] == canonical_path next_path = maglev_rendering_mode == :editor ? site_preview_path(path: canonical_path) : "/#{canonical_path}" redirect_to next_path, status: :moved_permanently true end end end
Version data entries
10 entries across 10 versions & 1 rubygems