Best way to allow client to do SEO on view files?

I’m about to start work on a project for a client that is huge into SEO
and conversion tracking, etc. One of the goals of the project is to make
sure that each (HTML) page’s meta information can be tweaked separately.
But, I still want to make liberal use of layouts to keep with the DRY
philosophy (and because all his older projects used untemplated files
and were NIGHTMARES to try to work with)

Does anyone know of a good way of handling this? Are partials the best
way? Oh, and the client id comfortable with HTML, but Ruby might be a
stretch for him (though he can work his way around PHP pretty well).

I have a few more questions on related topics, but I’ll use different
threads so as not to confuse the conversation.

Thanks!

Chris B. wrote:

I’m about to start work on a project for a client that is huge into SEO
and conversion tracking, etc. One of the goals of the project is to make
sure that each (HTML) page’s meta information can be tweaked separately.

if each page is required to be tweaked separately, why not save the
tweaked info into the db? (gathering you have a Pages table or something
similar) and then you could just gather the info per page, in the
layout:

layout.rhtml

> ... .. .

I’m about to start work on a project for a client that is huge into SEO
and conversion tracking, etc. One of the goals of the project is to make
sure that each (HTML) page’s meta information can be tweaked separately.
But, I still want to make liberal use of layouts to keep with the DRY
philosophy (and because all his older projects used untemplated files
and were NIGHTMARES to try to work with)

Does anyone know of a good way of handling this? Are partials the best
way? Oh, and the client id comfortable with HTML, but Ruby might be a
stretch for him (though he can work his way around PHP pretty well).

In your view at the very top:

<% @page_title = ‘My Page Title’ -%>
<% @meta_description = ‘My Meta Description’ -%>
<% @meta_keywords = ‘my key words’ -%>

In your layout:

<%= @page_title ? @page_title : "Some Default" %> <%= @meta_keywords ? "" : "" %> <%= @meta_description ? "" : "" %>

Works great for us. It also allows us to set the @page_title and
@meta_description to something relevant for instances of say
/product/show/1 and /product/show/2 by using attributes of @product in
the
view…

-philip

Shai R. wrote:

if each page is required to be tweaked separately, why not save the
tweaked info into the db? (gathering you have a Pages table or something
similar) and then you could just gather the info per page, in the
layout:

That’s an option I hadn’t considered. I’m not sure that that fits our
need 100% as the client will need to tweak these often, and building a
whole new administrative piece for modifying meta data would be
cumbersome. Thanks for the suggestion though!

Philip H. wrote:

In your view at the very top:

<% @page_title = ‘My Page Title’ -%>
<% @meta_description = ‘My Meta Description’ -%>
<% @meta_keywords = ‘my key words’ -%>

In your layout:

<%= @page_title ? @page_title : "Some Default" %> <%= @meta_keywords ? "" : "" %> <%= @meta_description ? "" : "" %>

Wonderful! I think that makes sense and fits our needs. Thank you.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs