Project

tytus

0.0
No commit activity in last 3 years
No release in over 3 years
Tytus gives you a declarative manner in which to title your pages in order to improve overall design of your app and increase findability of your pages in search ranks.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 0
 Project Readme

Tytus

Gem Version Build Status Dependency Status Code Climate Coverage Status Inline docs

Helps you manage page titles in your Rails application.

Tytus gives you a declarative manner in which to title your pages in order to improve overall design of your app and to increase findability of your pages in search ranks.

Installation

Add to your Gemfile:

gem 'tytus'

And then execute:

$ bundle

Or install it yourself as:

$ gem install tytus

Usage

Update your locales file as in the following:

en:
  titles:
    site_name: Your site name goes here

In your controllers:

class ArticlesController < ApplicationController

  title 'A title for this particular controller'

end

and this title will be inherited by all actions within controller. Alternatiely, tytus will look for controller specific titles in your locales file. You can add them yourself under titles key as in the following:

en:
  titles:
    plural_controller_name: Your site name goes here

However, if you need you can overwrite controller specific title on per action basis:

class ArticlesController < ApplicationController

  title 'A title for this particular controller'

  def show
    title 'A title for this particular action'
  end
end

In your views:

<%- title 'A title for this particular view' %>

or 

<h1><%= title 'A title for this particular view that renders also inside enclosed tag' %></h1>

and this will overwrite controller set titles.

Once you set your titles, in your layout call helper method render_page_title:

<head>
  <title><%= render_page_title %></title>
</head>

By default :: separator is used to change this pass separator hash parameter:

<head>
  <title><%= render_page_title :separator => ' | ' %></title>
</head>

Development

Questions or problems? Please post them on the issue tracker. You can contribute changes by forking the project and submitting a pull request. You can ensure the tests are passing by running bundle and rake.

Copyright

Copyright (c) 2011-2016 Piotr Murach. See LICENSE for further details.