Page 1 of 2
Custom Title Tags
Posted: Wed Dec 08, 2010 5:18 am
by nickjulia
If I wanted the Title tag for each product page to be the following:
Product Category | Product name | Modelnum | Some Keyword Dense Text
How would I do that. Also, is there a way to setup some custom title tags for the home page?
Thanks
Re: Custom Title Tags
Posted: Wed Dec 08, 2010 11:40 am
by Johnathan
I originally posted this
here, but just so the information is also in this thread:
The way I do it is to use the Meta Keywords field as an optional "page title" field, and override the default title if anything in Meta Keywords exists. It's an easy, one-line edit:
IN:
Code: Select all
/catalog/view/theme/YOURTHEME/template/common/header.tpl
REPLACE:
WITH:
Code: Select all
<?php if ($keywords) { echo $keywords; } else { echo $title; } ?>
Re: Custom Title Tags
Posted: Wed Jan 19, 2011 9:54 am
by ifyouseek
works great! thanks.
Did you remove the meta keywords from the template or just leave it in?
Re: Custom Title Tags
Posted: Wed Jan 19, 2011 10:49 pm
by Johnathan
I think I just left it in. Most search engines don't use the meta keywords field anyway.
Re: Custom Title Tags
Posted: Fri Jan 21, 2011 1:12 pm
by jcgadgets
Hi,
This looks great - but I'd rather be able to input the words for the title tag from a source other than the meta keywords field. I know that they say most of the search engines don't use them at all...but I'm hesitant to completely disregard them :S Is there a simple way to still get custom title tags, or should I just forget it and go with this solution?
Thank you,
Jared
Re: Custom Title Tags
Posted: Fri Jan 21, 2011 6:28 pm
by Chones
Hi Jared,
You can EXTEND your title tags if you want, using the location field - that's what I do and it works really well.
http://forum.opencart.com/viewtopic.php?t=9640
Re: Custom Title Tags
Posted: Fri Jan 21, 2011 8:48 pm
by JAY6390
Just to note
Code: Select all
<?php if ($keywords) { echo $keywords; } else { echo $title; } ?>
can be reduced to
Code: Select all
<?php echo $keywords ? $keywords : $title; ?>
I know it's not much but for such a simple line I like it "clean"
Re: Custom Title Tags
Posted: Fri Jan 21, 2011 9:55 pm
by Johnathan
JAY6390 wrote:Just to note
Code: Select all
<?php if ($keywords) { echo $keywords; } else { echo $title; } ?>
can be reduced to
Code: Select all
<?php echo $keywords ? $keywords : $title; ?>
I know it's not much but for such a simple line I like it "clean"
Yeah, I don't know why I put the longer version in there originally. Clarity, maybe? Anyway, good suggestion.
Re: Custom Title Tags
Posted: Mon Mar 21, 2011 8:30 am
by BrianW
Ah, thank you so much for this! Fantastic and simple solution to get custom titles on your products and categories!
Re: Custom Title Tags
Posted: Thu Jun 16, 2011 4:41 pm
by vlad123
Johnathan wrote:I originally posted this
here, but just so the information is also in this thread:
The way I do it is to use the Meta Keywords field as an optional "page title" field, and override the default title if anything in Meta Keywords exists. It's an easy, one-line edit:
IN:
Code: Select all
/catalog/view/theme/YOURTHEME/template/common/header.tpl
REPLACE:
WITH:
Code: Select all
<?php if ($keywords) { echo $keywords; } else { echo $title; } ?>
Just tried this method and its works great.
Makes thins for me much easier
Thank for your contribution.
Re: Custom Title Tags
Posted: Sat Nov 05, 2011 12:22 am
by shimon
What is the code syntax if I want my Title Tag to dynamically look like this:
Rings | Sapphire Rings | Large Sapphire Ring - MySite Name
For this URL:
http://www.mysite.com/rings/sapphire-ri ... phire-ring
Using the Category, Subcategory, Product Name
Any help will be much appreciated.
Re: Custom Title Tags
Posted: Sat Nov 05, 2011 2:10 am
by dony_b
What if I wanted the manufacturers name there ?
will this work ?
Code: Select all
<?php if ($manufacturer) { echo $$manufacturer; } else { echo $title; } ?>
Re: Custom Title Tags
Posted: Tue Nov 08, 2011 7:00 am
by 24leaves.com
Yeap!
This is how some muppets can just ruin your business.
With ideas like this....
Yeap! You can change the title tag changing this code..... bla bla bla
YOU! STUPID PHP GUYS!
I just got penalized by google doing what you said. I am not in the first 50 pages on search engines after I had that little line changed for no more than 3 hours. Fortunately I realized what I have done and now I am waiting for google to put me back in rights.
IF YOU CHANGE YOUR TITLE TAGS ON ALL THE PAGES ( with a smart php code) GOOGLE WILL SPIT YOU LIKE A BAD TEETH.
DO NOT DO IT UNTIL YOU JUST STARTED WITH YOUR WEBSITE AND YOU HAVE NO CATEGORY OR PRODUCT IN YOUR WEBSITE!
OTHERWISE YOU"LL CRY LIKE ME!
Re: Custom Title Tags
Posted: Tue Nov 08, 2011 7:03 am
by JAY6390
That is absolute nonsense. Google doesn't kick you out for having different title tags. What it will kick you out for is cloaking, where you mask the content of your site with information relating to something completely different
Re: Custom Title Tags
Posted: Wed Nov 09, 2011 1:36 pm
by 24leaves.com
So... you didn't heard what I've just said! Why don't you search my domain.. 24leaves on google to figure out yourself that I am right.I am not... clocking or whatever you are talking about. My content is not obvious so...that is what you get on changing that line.Do it yourself on your website with 100 products in 14 languages and you'll see what I am talking about.
Have a nice day!
Re: Custom Title Tags
Posted: Wed Feb 08, 2012 2:25 am
by ifyouseek
google might not like the sudden change to all product and category title tags.. it would definitely effect your rankings initially but in the long term i think this solution will help you rank higher for the more specific keywords you are targeting rather than just targeting the actual product name like standard unmodded opencart does.
Re: Custom Title Tags
Posted: Wed Apr 24, 2013 6:19 am
by michael2820
JAY6390 wrote:Just to note
Code: Select all
<?php if ($keywords) { echo $keywords; } else { echo $title; } ?>
can be reduced to
Code: Select all
<?php echo $keywords ? $keywords : $title; ?>
I know it's not much but for such a simple line I like it "clean"
NO, my experience do NOT reduce it
Re: Custom Title Tags
Posted: Wed Apr 24, 2013 7:03 am
by JAY6390
Care to give a reason as to why not? It's cleaner, just as efficient if not more so and does exactly the same thing
Re: Custom Title Tags
Posted: Wed Apr 24, 2013 5:51 pm
by michael2820
@JAY6390: I use version 1.4.9.6. First of all: I am talking about this line
<title><?php if ($keywords) { echo $keywords; } else { echo $title; } ?></title>
I followed your advice many months ago, but then I looked closely to the title in Google results and compared with the string I have written in the field "Meta tag keywords" and it was not identical. Google results showed the string in "Product name". Yesterday I changed it back and then it worked. You can see the difference in
my shop - look to the very top at the titlebar of the browser and compare with the name of the product.
Re: Custom Title Tags
Posted: Wed Jun 05, 2013 5:48 am
by Wooly
I just used this, and although it is working, it is over riding the title... is this okay?
of course i would like neatly written title tags but i dont want it to jeopardise my rating. Can someone just assure me whether this is right or wrong?
Many thanks