Skip to content

Instantly share code, notes, and snippets.

Created May 2, 2014 07:16
Show Gist options
  • Save anonymous/2979bb4a0bc06bdfe0b6 to your computer and use it in GitHub Desktop.
Save anonymous/2979bb4a0bc06bdfe0b6 to your computer and use it in GitHub Desktop.
content for titles
<!DOCTYPE html>
<html>
<head>
<title><%= content_for?(:title) ? "#{yield(:title)} - Default Site Name" : "Default Site Name" %></title>
</head>
<% content_for :title do %>Index of some Page<% end %>
If your template doesn't define a content_for(:title), it will default to the name "Default Site Name".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment