calebhearth/title

Specific titles for high_voltage pages

Closed this issue · 2 comments

Is it possible to use the title gem for titles of high_voltage pages?

high_voltage route looks as follows:

page     GET    /pages/*id                high_voltage/pages#show

Currently I can only provide a generic title which will be shown for any high_voltage page then:

en:
  titles:
    high_voltage:
      pages:
        show: "Generic title"

However I would like to show a specific 'About this page' title if a user e.g. visits /pages/about.

There's no good way to do this with High Voltage, unfortunately.

Best I can think of would be to inherit HV::PagesController and set an instance variable like @title that you could then use in your titles, but you'd have a gigantic case statement, a hash, etc. to set each page's title which isn't great and mostly defeats the purpose, I think. Generally I've seen a different layout used with HighVoltage, where you can use a different title helper like page_title to set those titles.

Thanks for your answer. Then I will stay with the content_for(:page_title) workaround for now.