6
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

PhoenixFrameworkでレイアウトを無効にする方法

Posted at

状況

RSS,AMP,Instant Articles対応している時に、既存のレイアウトを適用しないテンプレートを作成したかった。

環境

Elixir 1.3.0
Phoenix Framework 1.1.6

解決方法

Phoenix.Controller.put_layout/2false を設定する

Controller全体に適用したい場合

defmodule App.HogeController do
  plug :put_layout, false
end

特定のレンダリングにのみ適用したい場合

defmodule App.HogeController do
  def index(conn, _params) do
    conn
    |> put_layout(false)
    |> render("index.html")
   end
end
6
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?