Trouble in SEOland: Ruby on Rails frustration

by orvn
4 replies
  • WEB DESIGN
  • |
Hello,

So I'm trying to integrate some META tags and whatnot into a website.
Turns out the site runs nginx on the server and appears to the using a Ruby on Rails framework.

The website is using ERB files that are somehow run from a template engine.

When I go to ..../sitename_main/stable/app/views/main/ (damn that's deep in the tree!)

I find a whole bunch of files that appear to be the ones I am looking for.
index.html.erb
page1.html.erb

So I open them up and it turns out that they start directly from the <body>, no doctype, head or title tags!

I did some digging and it turns out I may learn more by visiting
..../sitename_main/stable/app/views/layout/
in this subdirectory, there's a file called application.html.erb.
but it's empty?!

I'm so perplexed, please help. I do have programming experience and I just spent a few hours learning to program in Ruby, I got the hang of it, but I have no idea of what I'm doing in terms of Rails.

Merçi!
#frustration #rails #ruby #seoland #trouble
  • Profile picture of the author Jesus Carrera
    in application.html.rb is where you are supposed to have your <htm>, <head>, and <body> tags. To have different meta tags for each page, you put something like this:

    <meta name="description" content="<%= yield :description %>" />

    and in the page:

    <% content_for :description do %>The description<% end %>

    Hope this helps.
    {{ DiscussionBoard.errors[2729035].message }}
    • Profile picture of the author orvn
      Thanks for the reply!
      It turns out textedit wasn't opening the file correctly.
      In my layouts folder, when I open up application.html.erb (the only file there) I see this:

      PHP Code:
      <%= yield :extra_header_tags %>     
      <%= 
      stylesheet_link_tag 'jquery.lightbox-0.5' %>     
      <%= 
      stylesheet_link_tag 'style.css' %> 
          <%= yield :
      stylesheets %>       
      <%= 
      javascript_include_tag ['jquery''jquery.lightbox-0.5''java.js'] %>     <%= yield :javascripts %>    
      <%= yield %> 
      I understand what you mean about the titles, and head tags, however my application.html.erb file only appears to specify stylesheets?

      What if I'm trying to add a different value for METAs, on say, 10 different pages, should I create individual variables or is there some way I should create an array?
      Signature
      Orun Bhuiyan[@orvn] [linkedin] See what I've been doing lately by visiting my marketing agency's site. SEOcial specializes in content marketing and integrated optimization. We create conversions for businesses by gracefully connecting the realms of design, development and marketing.

      {{ DiscussionBoard.errors[2732494].message }}
      • Profile picture of the author orvn
        edit -
        Signature
        Orun Bhuiyan[@orvn] [linkedin] See what I've been doing lately by visiting my marketing agency's site. SEOcial specializes in content marketing and integrated optimization. We create conversions for businesses by gracefully connecting the realms of design, development and marketing.

        {{ DiscussionBoard.errors[2735386].message }}
  • Profile picture of the author kersimp
    Hi,

    I've searched for similar problems as yours and here is what I found. You can use these codes in your template:

    <% content_for :html_title, 'My Specific Page Title' %>
    <% content_for :html_description, 'My Specific Page Description' %>
    {{ DiscussionBoard.errors[3151543].message }}

Trending Topics