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! -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Philip Hallstrom
2007-Sep-14 20:16 UTC
Re: 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).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: <title><%= @page_title ? @page_title : "Some Default" %></title> <%= @meta_keywords ? "<meta name=''keywords'' content=''#{@meta_keywords}'' />" : "" %> <%= @meta_description ? "<meta name=''description'' content=''#{@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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Shai Rosenfeld
2007-Sep-17 08:10 UTC
Re: Best way to allow client to do SEO on view files?
Chris Bloom 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 <html> <head> <meta name="description" content=<%= @page.seo %> > ... .. . -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Shai Rosenfeld 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 Hallstrom 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: > > <title><%= @page_title ? @page_title : "Some Default" %></title> > <%= @meta_keywords ? "<meta name=''keywords'' content=''#{@meta_keywords}'' > />" : "" %> > <%= @meta_description ? "<meta name=''description'' > content=''#{@meta_description}'' />" : "" %>Wonderful! I think that makes sense and fits our needs. Thank you. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---