Class: Archangel::Frontend::PagesController

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

Overview

Frontend pages controller

Direct Known Subclasses

HomepagesController

Instance Method Summary collapse

Methods included from Controllers::MetatagableConcern

#assign_meta_tags

Methods inherited from ApplicationController

#current_site, #render_401_error, #render_404_error, #render_error

Methods included from Controllers::PaginatableConcern

#page_num, #per_page

Methods included from Controllers::ActionableConcern

#action, #collection_action?, #member_action?

Instance Method Details

#showObject

Frontend page

Formats

HTML, JSON

Params

[String] permalink - the permalink to the page

Request

GET /:permalink
GET /:permalink.json

Response

{
  "id": 123,
  "title": "Page Title",
  "permalink": "/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_design_content,
             layout: layout_from_theme
    end
    format.json do
      @page.content = liquid_rendered_content

      render(template: "archangel/frontend/pages/show", layout: false)
    end
  end
end