Rails: How to change the title of a page?

前端 未结 15 1292
没有蜡笔的小新
没有蜡笔的小新 2020-11-30 17:08

What is the best way to create a custom title for pages in a Rails app without using a plug-in?

15条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-30 17:26

    I use nifty_generator's "nifty_layout" which provides with a title variable which I can call then on the page using:

    <% title "Title of page" %>

    I can also user <% title "Title of page", false %> to have the title just show in browser title and not in the page itself.

提交回复
热议问题