4.1 Motivation

But what if we don’t provide a title? It’s a good convention to have a
base title we use on every page, with an optional page title if we want
to be more specific. We’ve almost achieved that with our current layout,
with one wrinkle: as you can see if you delete the provide call in one
of the views, in the absence of a page-specific title the full title
appears as follows:

Ruby on Rails Tutorial Sample App |

In other words, there’s a suitable base title, but there’s also a
trailing vertical bar character | at the end.

To solve the problem of a missing page title, we’ll define a custom
helper called full_title. The full_title helper returns a base title,
“Ruby on Rails Tutorial Sample App”, if no page title is defined, and
adds a vertical bar followed by the page title if one is defined
(Listing 4.2).1