Project

nazca

0.0
No commit activity in last 3 years
No release in over 3 years
Rails 3 / Rails 4 plugin that makes title and meta tags (keywords, description) easy and manageable.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.0

Runtime

>= 3.0
 Project Readme

nazca

Nazca is a Rails 3 / Rails 4 plugin to easily deal with all your <title> and <meta> tags, making your app more usable for people and more visible for search engines.

Build Status

Why?

Using instance variables for this purpose seemed so scruffy. Wrapping some code in this little plugin made my layout templates much smaller and cleaner as I could add all my meta tags in a single line of code.

Usage

<%= meta_tags "My awesome little site" %>

will yield: <title>My awesome little site</title>

# In views/posts/new.html.erb
<% title "Creating a post" %>

# In views/layouts/application.html.erb
<%= meta_tags "My awesome little site" %>

gives <title>My awesome little site | Creating a new post</title>.

You can specify the title inside a header tag as the title method returns the title itself:

<h1><%= title "Creating a post" %></h1>

Reversing order

<%= meta_tags "My awesome little site", :reverse => true %>

which yields <title>Creating a new post | My awesome little site</title>

Setting a custom separator

<%= meta_tags "My awesome little site", :reverse => true, :separator => "::" %>
<title>Creating a new post :: My awesome little site</title>

Setting description and keywords meta tag:

<% title "Creating a post" %>
<% keywords "omg,so,sweet" %>
<% description "Cute cats programming Ruby." %>
<%= meta_tags "My awesome little site" %>

<title>My awesome little site | Creating a post</title>
<meta content="Cute cats programming Ruby." name="description" />
<meta content="omg,so,sweet" name="keywords" />

Why there are no controller methods to globally set up meta tags?

Because I respect MVC. Meta tags are views-specific.

Rails 2?

Fork you.

License

MIT.