Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Category Specific Meta Tags


Recommended Posts

Just submitted a contibution at

 

http://www.oscommerce.com/community/contributions,1176

 

This contribution will help your ranking. You are able to add specific title, description and keywords to individual category pages.

 

Original and quite useful contributions such as header_tags allow you to control each product but only product.

 

This contribution is meant to enable you to further improve your page rank and site popularity by changing the meta tags through a category specific means.

 

If anyone has any ideas on how to improve the meta tags to subcategories using the index.php logic please let me know.

 

Thanks

Link to comment
Share on other sites

  • Replies 66
  • Created
  • Last Reply

Top Posters In This Topic

Oh by the way this will not interfere with linda's contribution but will work in tandem with it. The outline specified in the contribution is only necessary in the default.php page and effects categories sitewide.

 

If anyone has ideas about how to make this also effect unlimited subcategories perhaps tying it in with the category description module give me a holler.

 

Thanks

 

Haast omhoog met de halveringstijd van handel

Link to comment
Share on other sites

Very nice, I'll be sure to check it out :)

 

I installed Linda's header tags which really does some nice things, but I didn't really want product specific meta because I'm looking at a huge product database, and I dont want to scare the dataentry guys. I also want to make as few changes to products table as possible so all the mods work (although I was thinking of modifying HeaderTags to use a seperate table for storing meta/titles and then just do an SQL join, so you can access the meta fields without modifying products).

 

But yeah, I like the idea of category specifc meta better really, simply because I'm lazy and I'll have to come up with less sets of meta :)

Link to comment
Share on other sites

Very nice, I'll be sure to check it out :)

 

I installed Linda's header tags which really does some nice things, but I didn't really want product specific meta because I'm looking at a huge product database, and I dont want to scare the dataentry guys. I also want to make as few changes to products table as possible so all the mods work (although I was thinking of modifying HeaderTags to use a seperate table for storing meta/titles and then just do an SQL join, so you can access the meta fields without modifying products).

 

But yeah, I like the idea of category specifc meta better really, simply because I'm lazy and I'll have to come up with less sets of meta :)

 

I think Linda' contrib pulls the product name and description if you don't add one separately.

[no external urls in signatures please, kthanks]

Link to comment
Share on other sites

I installed the mod without errors....how can we test or see if it's working correctly? I did a "view source" to see if the meta tags were added and they are not... :?:

Link to comment
Share on other sites

View Source should show the meta if its working correctly

 

That's what I figured....view source on what would be default.php right? Any ideas on how to troubleshoot what seems to be an easy mod?

 

TIA

Link to comment
Share on other sites

Did you edit and upload all 30+ pages to include the META tags?

 

NOTE: the code to paste in ... the word TITLE should be TITLE; ... it is listed one place correctly and another incorrectly in the README

 

Do you have a URL we can peek at?

Link to comment
Share on other sites

Did you edit and upload all 30+ pages to include the META tags?

 

NOTE: the code to paste in ... the word TITLE should be TITLE; ... it is listed one place correctly and another incorrectly in the README

 

Do you have a URL we can peek at?

 

Hi Linda,

 

30 pages? uh no....the instructions for this hack makes no mention of that. We are talking about the same contrib right? the one posted by "winteraudio" i think the handle is?

 

I was going to try yours next.... :D

 

My LIVE site is here: www.lildevilmotorsports.com

Link to comment
Share on other sites

oops ... sorry ... Header Tags Controller on the brain ... 8)

 

no prob.... :D

 

I will attempt yours this evening....

 

Need better ranking!!! :?

Link to comment
Share on other sites

Anybody have any ideas on how to troubleshoot this contrib? (not Linda's). I don't get any errors and I have data in the table but the information is not appearing when I do a view source.

 

TIA

Link to comment
Share on other sites

View Source should show the meta if its working correctly

 

That's what I figured....view source on what would be default.php right? Any ideas on how to troubleshoot what seems to be an easy mod?

 

TIA

 

This modification has worked well for me.

I have tested it with Use Search-Engine Safe URLs (still in development) True and False., they both work.

 

To debug, make sure a category is selected i.e., your URL should be

of the form.

 

http://www.yourdomain.com/catalog/default.php?cPath=22

Then do a view source., and your Category Meta Tags should be visible.

 

There ARE however two problems when using it with Linda Category Tag generator.

 

1.) Lindas' tag generator generates empty tags when you have cPath=xyz

In this case you will have two sets of tags. Tags from this contribution

followed by tags from Linda's generator. I think we need to parse

the URL and if we see a cPath then send this contribution and for t

the rest send Lindas'. Not sure if cPath is used for anything else.

Any advice from someone more knowledgeable about this will be

appreciated.

 

2.) Also the tags of this contribution are sent before

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

I am not sure how it should be, so I will need to research this a bit before

I think this is a problem.

 

-ibandyop

ibandyop

Link to comment
Share on other sites

I actually found my problem. It seems like the web team that worked on the graphics for my site found it necessary to move many of the fucntions of default.php to a new file on my site. Once I discovered the redirect, I adjusted this contrib accordingly and voila! it works!

 

So now my meta tags are visible within all pages of my site

 

Rodney

www.lildevilmotorsports.com

Link to comment
Share on other sites

Playing with this code tonight to see how it would work with the subcategories as well as inserting a new title - but I've not yet worked out pulling out the original title. Here is my "work in progress" that seems to be generating the tags correctly at this late hour for the categories and subcategories with the addition of the <title> tags for both categories and their subs.

 

** I by NO means consider myself a PHP programmer as I'm only learning it at this point, but thought some may be interested in seeing this as something to work with or from... at least in theory anyway.

 

I added to the tep_meta_tags table via myphpadmin:

 

title - which is used for the original categories

subcat - which is the second part of $cPath

subcattitle - which is sub category title

subcatkeywords - which is sub category keywords

subcatdescription - whichis sub category description

 

I then altered the code as follows. Some is still commented out during my work. Just as a note, I do have Linda's Header Tag Controller also installed.

 

<?php

// /catalog/includes/meta_tags.php

// All Original Credit Referred to Tamim - www.TMPanime.com Added: Category Meta Tag Generator v1.0

// Add title, description and keyword meta tags to categories

//

// NOTE: Replace standard default.php meta tags with category specific meta tags

// USE phpMyAdmin to adjust category meta tags / admin tool is in the works

//

// Use you category #(number) and identify it in phpMyadmin / admin tool and subcategories in the works

if ($cPath)

{

$metaCategoryArray = explode ("_",$cPath); // take just the first part of $cPath

$metaCategory = $metaCategoryArray[0];   // assign first part of $cPath

$metaSubCategory = $metaCategoryArray[1];  

$category_query = tep_db_query ("select * from tep_meta_tags where category = '" . $metaCategory . "'");   





$totalRows = tep_db_num_rows($category_query);   // how many rows qualified for the category

if ($totalRows == 0){

$category_query = tep_db_query ("select * from tep_meta_tags where category = '0'");

}



if (($totalRows > 1) && ($metaSubCategory > 0)){

$subcat_query = tep_db_query ("select * from tep_meta_tags where subcat = '" . $metaSubCategory . "'");

$metaData = tep_db_fetch_array ($subcat_query);

$subcattitle = $metaData ['subcattitle'];

$subcatkeywords = $metaData ['subcatkeywords'];

$subcatdescription = $metaData ['subcatdescription'];

echo '<meta name="keywords" content="' . $subcatkeywords . '">';

echo '<meta name="description" content="' . $subcatdescription . '">';

echo '<title>' . $subcattitle . '</title>';

}

else {

$metaData = tep_db_fetch_array($category_query);

$title = $metaData['title'];

$keywords = $metaData ['keywords'];

$description = $metaData ['description'];

echo '<meta name="keywords" content="' . $keywords . '">';

echo '<meta name="description" content="' . $description . '">';

echo '<title>' . $title . '</title>';

}







// For all other pages (shopping cart, etc.)

//else

//{

//$category_query = tep_db_query ("select * from tep_meta_tags where category = '0'");

//$metaData = tep_db_fetch_array ($category_query);

//$keywords = $metaData ['keywords'];

//$description = $metaData ['description'];



//echo '<meta name="keywords" content="' . $keywords . '">';

//echo '<meta name="description" content="' . $description . '">';

//}

}

?>

 

 

Everything is still manually entered into the table via myphpadmin. I haven't a clue how to code the admin interface at this time. :roll:

 

To enter subcategory, add new row to table and enter the following:

 

category - which is the subcategory's parent - also the first half of $cPath - this is required for proper function

subcat which is the second part of $cPath

subcattitle which is sub category title

subcatkeywords which is sub category keywords

subcatdescription whichis sub category description

 

-shaun

Link to comment
Share on other sites

  • 1 month later...

I'm using the Categories Meta Tag contribution successfully, alond with the subcategory tweak posted here. I've recently added Linda's SEC which provides a drop down categories "jump to" box. Resulting pages have empty tags because the URLs don't conform to this module's URL definition. A link generated from the code below looks like this:

 

http://www.mydomain.com/index.php/jumpto/1...th=1&category=1

 

<form name="quick_jump" class="form" method="get" action="<?php echo tep_href_link(FILENAME_DEFAULT, 'jumpto=1', 'NONSSL'); ?>"><?php echo tep_draw_pull_down_menu('cPath', tep_get_categories(array(array('id' => '0', 'text' => 'Select a Category'))) , $current_category_id, 'onChange="this.form.submit();"'); echo '<input type=hidden name=category value=1>';?></form>

 

Anyone know how to get the categories meta tag module to accomodate this kind of link?

Link to comment
Share on other sites

  • 2 months later...

Hi,

 

I'm sure you all have moved on from this topic, but I too have installed Linda's Header Tags as well as both the Category Meta Tag contrib and the subcategory add-on listed in this post.

 

They all seem to work fine, except that on my category pages, both the category meta tags (from the cat meta tag contrib) and the default meta tags (from the header tags contrib) show up in the source code. Anyone know how to deactivate the default tags on the category pages?

 

Sorry if this is really obvious - I am still quite a newbie! And I couldn't find this topic referenced anywhere else in the boards!

 

Thanks a lot,

Caroline

Link to comment
Share on other sites

  • 1 month later...
Just submitted a contibution at

 

http://www.oscommerce.com/community/contributions,1176

 

This contribution will help your ranking. You are able to add specific title, description and keywords to individual category pages.

 

Original and quite useful contributions such as header_tags allow you to control each product but only product.

 

This contribution is meant to enable you to further improve your page rank and site popularity by changing the meta tags through a category specific means.

 

If anyone has any ideas on how to improve the meta tags to subcategories using the index.php logic please let me know.

 

Thanks

Hi

 

I tried this contrib recently and found a clash of variable names with the default Quick Find search utility.

 

Both the default config (2.2MS2) and the contrib us the variable name $keywords.

 

This results in the Quick Find box being populated with the meta_tag keywords data.

 

A simple change of all occurrences of $keywords to $metakeywords in the meta_tags.php file fixed this. My update showed 3 changes. I also changed $description to $metadescription as it seemed likely to be used elsewhere.

 

Other than this issue the contrib seems to do what it is meant to do.

 

The addition of sub-category and admin control will make it a great contrib.

 

Thanks

 

cheers

Tony

cheers
Tony
******************************
My oscMax Store RecoverToy :: Antique Toy Car Parts
Tony's Tech Blog
WrenMaxwell WebManagement
******************************

Link to comment
Share on other sites

  • 2 weeks later...

hi i would like to start using this mod but ran into a bit of a snag the sql file wont work i get an error

 

You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'NOT NULL , keywords text NOT NULL , description text NOT NUL

 

whats wrong

Link to comment
Share on other sites

  • 4 weeks later...
hi i would like to start using this mod but ran into a bit of a snag the sql file wont work i get an error

 

You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'NOT NULL , keywords text NOT NULL , description text NOT NUL

 

whats wrong

Hi,

It's is simple.

Try to write it to the sql witout "not null".I had the same problem. Later you can add "not null" manualy.

 

Mac22

Link to comment
Share on other sites

  • 2 months later...
  • 1 month later...

I am a bit lost with the instructions of this contribution:

3:>> INCLUDE the above file in the catalog/default.php file right after the <head> tag as below, replacing the default <title><?php echo TITLE; ?></title> (if this isn't replaced, you will end up with two titles on your page):

 

 

 

<head>

<? include(DIR_WS_INCLUDES . 'meta_tags.php'); ?>

 

What is default.php? I can't find any file by that name. :(

Link to comment
Share on other sites

  • 3 weeks later...
Then, in the table's structure, set "meta_id" to a unique key.

 

 

I'm not sure what this means, can someone explain what and where I put this? (be nice....)

 

thanks

Tammy

Edited by tammy507
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...