September 15th, 2010, 10:47 PM
Know nothing about Ruby, can't modify files on a website (index.html.erb??!)
I'm really confused. I know basic html, unix, php, few other things.
I need to add META tags for a friend, different tags on every page of his site.
Got into his FTP and his directory structure just boggled me.
He runs nginx.
After much searching I found all the files I needed with .erb extensions appended to them. There's a gems folder, so I'm guessing Ruby is involved.
When I go to ..../sitename_main/stable/app/views/main/ (damn that's deep in the tree!)
I find files like index.html.erb.
So I decided to try to edit these to add meta tags.
Didn't work.. the <title> and <head> area's of the page aren't changeable from there, the index.html.erb file just starts with:
<%= render :partial => "main/top_ban" %>
<img id="ban_1" src="images/index_banner.jpg" width="936px" height="290px" style="opacity: 0;"/>
<img id="ban_2" src="images/index_banner2.jpg" width="936px" height="290px" style="opacity: 0;"/>
<img id="ban_3" src="images/index_banner3.jpg" width="936px" height="290px" style="opacity: 0;"/>
<img id="ban_4" src="images/index_banner4.jpg" width="936px" height="290px" style="opacity: 0;"/>
<img id="ban_5" src="images/index_banner5.jpg" width="936px" height="290px" style="opacity: 0;"/>
How to I add meta tags (and titles) to each individual page?
Any help would be appreciated, thanks guys!!
September 16th, 2010, 06:58 AM
This sounds a lot like a Rails setup. Rails uses ERB (Ruby templating mechanism) extensively.
If you need to edit the head/title portions of the eventual file maybe you can look for the inclusion of that file you show in other sources. This is entirely a shot in the dark as I am unaware of your setup and dont know diddly about the inner workings of Rails. Consider the following
So you might have some success if you grep for something like
$ cat foo.rb
puts "In Foo"
$ cat bar.rb
puts "Bar included"
$ ruby foo.rb
Though, you may have more consistent reqults if you just read up on how Rails works and edit things the ways they suggest
egrep -Rn "require index.html.erb"
True happiness is not getting what you want, it's wanting what you've already got.
September 21st, 2010, 05:10 AM
Is there advantages of Ruby compared to php? Don't know would it be profitable for me to learn it
September 21st, 2010, 10:23 AM
Most likely, the code is using a template. What you need to do is look here:
and see if there is a file here that has <html><head>...
Then, all you have to do is modify this file and make it accept parameters from the controller:
and then modify your controller file (which should be /sitename_main/stable/app/controllers/main.rb) and add the following into the different functions here:
<title><%= @title %> - My Site Name</title>
<meta name="keywords" content="<%= @meta_keywords %>" />
<meta name="description" content="<%= @meta_description %>" />
You can modify the controller so that @title, @meta_keywords and @meta_description have a default value and then override in specific functions.
@title = "Custom title"
@meta_keywords = "Something, something else"
@meta_description = "Fee fie fo fum"
Up the Irons
What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
"Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
Down with Sharon Osbourne
"I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
October 13th, 2010, 10:07 AM
ruby is a pure object oriented language
As compared to php, ruby is a pure Object oriented language. ruby possesses many metaprogramming attributes which can be used in rails development.
October 15th, 2010, 06:51 PM
Hello! I had to re-register with a new username, as I was having problems with my old email account., I'm the same user who started this thread though.
First of all, thanks SO much for the response.
Originally Posted by Scorpions4ever
When I go to ...sitename/stable/app/views/layouts
There is one file in the subdirectory, it is entitled application.html.erb.
Is this the file I'm looking for?
When I try to download it, all I get is an empty file..
Could it be that I just don't have access permissions or should I be taking a different course of action?