Class: Archangel::Frontend::PagesController

Inherits:
Archangel::FrontendController show all
Defined in:
app/controllers/archangel/frontend/pages_controller.rb

Overview

Frontend pages controller

Instance Method Summary collapse

Methods included from SeoableConcern

#apply_meta_tags

Methods inherited from ApplicationController

#current_site, #render_401_error, #render_404_error, #render_error

Methods included from PaginatableConcern

#page_num, #per_page

Methods included from ActionableConcern

#action, #collection_action?, #edit_action?, #index_action?, #member_action?, #new_action?, #restful_action?, #save_action?, #show_action?

Instance Method Details

#showObject

Frontend page

Formats

HTML, JSON

Params

[String] path - the path to the page

Request

GET /:path
GET /:path.json

Response

{
  "id": 123,
  "title": "Page Title",
  "path": "path/to/page",
  "content": "</p>Content of the page</p>",
  "homepage": false,
  "published_at": "YYYY-MM-DDTHH:MM:SS.MSZ",
  "created_at": "YYYY-MM-DDTHH:MM:SS.MSZ",
  "updated_at": "YYYY-MM-DDTHH:MM:SS.MSZ",
}


41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'app/controllers/archangel/frontend/pages_controller.rb', line 41

def show
  return redirect_to_homepage if redirect_to_homepage?

  respond_to do |format|
    format.html do
      render inline: liquid_rendered_template_content,
             layout: layout_from_theme
    end
    format.json do
      @page.content = liquid_rendered_content

      render json: @page, layout: false
    end
  end
end