Author Topic: [Mod] Homepage and Category Meta Title and Description For Better SEO  (Read 28408 times)

0 Members and 1 Guest are viewing this topic.

Offline ashfaq

  • Full Member
  • ***
  • Posts: 128
    • View Profile
I have a 4images based free desktop wallpaper website: http://www.deskbeauty.net
Its shows same one title on whole the website either it is homepage or any category and you know its not good for seo.
As for better seo it is necessary that homepage has different meta title and description and every category has different meta title and description related to that category.
So we can get better ranking in search engines.

Will anyone please guide me how to do that.

Rembrandt

  • Guest
Re: [Mod] Homepage and Category Meta Title and Description For Better SEO
« Reply #1 on: August 11, 2012, 12:29:42 PM »
Hi!
....As for better seo it is necessary that homepage has different meta title and description and every category has different meta title and description related to that category.
.....
you are right...

1.) search in your lang/main.php ,"?>" and insert above:

//-----------------------------------------------------
//--- META for Homepages ------------------------------
//----------------------------------------------------- 
$lang['meta_description'] = "Here come the Description for the Homepages";
$lang['meta_keywords'] = "Here,come,the,Keywords,for,the,Homepages";


2.) search in index.php:

//-----------------------------------------------------
//--- Show Categories ---------------------------------

insert above:

//-----------------------------------------------------
//--- SEO variables -----------------------------------
//-----------------------------------------------------
    
$site_template->register_vars(array(
      
"detail_meta_description"   => $lang['meta_description'],
      
"detail_meta_keywords"      => $lang['meta_keywords']
      ));


3.) search in categories.php:

$site_template
->register_vars(array('prepend_head_title' => $cat_cache[$cat_id]['cat_name'] . " - "));

and replace:

    $meta_description 
= !empty($cat_cache[$cat_id]['cat_description']) ? htmlspecialchars(strip_tags(trim($cat_cache[$cat_id]['cat_description']))) . ". " "";
    
$meta_description preg_replace('/[\n\t\r]+/'' ',$meta_description);
    
$meta_keywords preg_replace("#[-_'`´\^\$\(\)<>\"\|,@\?%~\+\.\[\]{}:\/=!§\\\\]+#s"" "$meta_description);
    
    
$meta_keywords_array array_unique(explode(" ",$meta_keywords));
    
$meta_keywords "";
      foreach(
$meta_keywords_array as $val){
        
$len strlen($val);
        if (
$len >= 5) {
          
$meta_keywords .=  $val.",";
        }
      } 

    
$site_template->register_vars(array(
      
"detail_meta_description"   => $meta_description,
      
"detail_meta_keywords"      => $meta_keywords,
      
"prepend_head_title"        => $cat_cache[$cat_id]['cat_name'] . " - "
      
));


4.) search in your templates/header.html:
Code: [Select]
<meta name="description" content="{detail_meta_description}{site_name}">
and replace:
Code: [Select]
<meta name="description" content="{detail_meta_description}">

Now can you write in your lang/main.php the description and the keywords for your Home page.
Do they have a category description, it displays as "META Description" on the current Category page.
The "META Keywords" are generated automatically from the category description.

mfg Andi
« Last Edit: August 11, 2012, 03:31:08 PM by Rembrandt »

Offline ashfaq

  • Full Member
  • ***
  • Posts: 128
    • View Profile
Re: [Mod] Homepage and Category Meta Title and Description For Better SEO
« Reply #2 on: August 11, 2012, 01:36:16 PM »
Thanks bro for quick help but i found few errors, please have a look below.

I am using 4images1.7.4 and cant find below code in categories.php
$site_template->register_vars(array('prepend_head_title' => $cat_cache[$cat_id]['cat_name'] . " - "));

Also there is no file named header.php in templates folder, even header.html did not have your given below code.
<meta name="description" content="{detail_meta_description}{site_name}">

As i can see this code will show unique title, description and keywords for homepage but how to show every category own unique title, description and keywords?

Hope this time you will also hlep to do best seo which will be very usefull for all 4images users.

Rembrandt

  • Guest
Re: [Mod] Homepage and Category Meta Title and Description For Better SEO
« Reply #3 on: August 11, 2012, 01:56:30 PM »
.....Hope this time you will also hlep to do best seo which will be very usefull for all 4images users.

Sorry, but i make no Modification for 6 year old Galleries.
i make her almost every mod,  but i can't make one for each version.

You can download the new 4images from here, and compare the code self.

mfg Andi

Offline ashfaq

  • Full Member
  • ***
  • Posts: 128
    • View Profile
Re: [Mod] Homepage and Category Meta Title and Description For Better SEO
« Reply #4 on: August 11, 2012, 02:34:07 PM »
Bro thanks for quick reply.
I want to upgrade to new version but infact i made many modes in 4images 1.4.7 version and i really dont how many mods i made and how many can work with new version so its my bad luck that many times i think to upgrade to new version but these things bound me to stay on old version.

As you are coder, programer and moder so its not difficult task for you and it will take your few minutes but it will make my life very easy, please its a request.
You can refuse my request but if you please do it i will be very thankfull.

Rembrandt

  • Guest
Re: [Mod] Homepage and Category Meta Title and Description For Better SEO
« Reply #5 on: August 11, 2012, 03:24:26 PM »

3.) search in categories.php( for V1.7.6 and older):

//-----------------------------------------------------  
//--- Show Categories --------------------------------- 

and insert above:

    $meta_description 
= !empty($cat_cache[$cat_id]['cat_description']) ? htmlspecialchars(strip_tags(trim($cat_cache[$cat_id]['cat_description']))) . ". " "";
    
$meta_description preg_replace('/[\n\t\r]+/'' ',$meta_description);
    
$meta_keywords preg_replace("#[-_'`´\^\$\(\)<>\"\|,@\?%~\+\.\[\]{}:\/=!§\\\\]+#s"" "$meta_description);
    
    
$meta_keywords_array array_unique(explode(" ",$meta_keywords));
    
$meta_keywords "";
      foreach(
$meta_keywords_array as $val){
        
$len strlen($val);
        if (
$len >= 5) {
          
$meta_keywords .=  $val.",";
        }
      } 

    
$site_template->register_vars(array(
      
"detail_meta_description"   => $meta_description,
      
"detail_meta_keywords"      => $meta_keywords,
      
"prepend_head_title"        => $cat_cache[$cat_id]['cat_name'] . " - "
      
));



4.) search in your Template /header.html:
Code: [Select]
<title>{site_name}</title>
and replace:
Code: [Select]
<title>{prepend_head_title}{site_name}</title>
<meta name="description" content="{detail_meta_description}">
<meta name="keywords" content="{detail_meta_keywords}">  

mfg Andi
« Last Edit: August 14, 2012, 08:19:11 PM by Rembrandt »

Offline ashfaq

  • Full Member
  • ***
  • Posts: 128
    • View Profile
Re: [Mod] Homepage and Category Meta Title and Description For Better SEO
« Reply #6 on: August 12, 2012, 11:58:37 AM »
Thanks man everything is working very well.
Rembrandt you prove that you are really 4images guru.
Thank you

Only one thing left untouched and its details page, will you pleaes also do some seo code for this page ?

Offline bergblume

  • Sr. Member
  • ****
  • Posts: 463
  • on to the top!
    • View Profile
Re: [Mod] Homepage and Category Meta Title and Description For Better SEO
« Reply #7 on: November 03, 2012, 10:11:05 AM »
Servus Andi,

ich hätte zu diesem tollen MOD von dir eine kleine (Ergänzungsfrage):

wie kann ich bei der Meta Description die Zeichenanzahl definieren und bei den Meta Keywords die Anzahl der Keywörter?
(vor allem dann auch für die details.php)

Danke dir für deinen Support hierzu!

Gruss,
bergblume

Rembrandt

  • Guest
Re: [Mod] Homepage and Category Meta Title and Description For Better SEO
« Reply #8 on: November 03, 2012, 11:58:20 AM »
Hi!

suche in Step 3.):

    $site_template
->register_vars(array(
      
"detail_meta_description"   => $meta_description,


und füge darüber ein:

    $meta_description  
word_count($meta_description,10); // <- die Anzahl der Wörter kannst du hier festlegen.
    
$meta_keywords  word_count($meta_keywords,10); // <- die Anzahl der Wörter kannst du hier festlegen.



Ich würde bei dem Zählen der "Wörter" bleiben, bei "Zeichen" zählt alles auch leerzeichen, und dann hast du im Quelltext abgeschnitte Wörter drinnen stehen.

Offline bergblume

  • Sr. Member
  • ****
  • Posts: 463
  • on to the top!
    • View Profile
Re: [Mod] Homepage and Category Meta Title and Description For Better SEO
« Reply #9 on: November 03, 2012, 05:32:43 PM »
wie immer vielen Dank für den klasse Support!

Offline Starblade

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: [Mod] Homepage and Category Meta Title and Description For Better SEO
« Reply #10 on: October 23, 2014, 12:01:40 PM »
Ist dieser Mod auch interessant für Version: 1.7.11 ?  :D

Rembrandt

  • Guest
Re: [Mod] Homepage and Category Meta Title and Description For Better SEO
« Reply #11 on: October 23, 2014, 12:46:43 PM »
Hi!
Ist dieser Mod auch interessant für Version: 1.7.11 ?  :D
Aber sicher doch.. :9

mfg Andi

Offline MorYeL

  • Pre-Newbie
  • Posts: 9
    • View Profile
Re: [Mod] Homepage and Category Meta Title and Description For Better SEO
« Reply #12 on: March 22, 2015, 09:41:42 PM »
Hi to all. There is a problem on categories pages on my 4images about this mod. Description and keywords meta tags doesn't work.

They are seems
Code: [Select]
"description= ".", keywords="" on http://www.widexl.com/seo/metatag-analyzer.html

But there isn't problem on image pages and index pages, mod is working heres.

I think, it is because of this code:

$meta_description = !empty($cat_cache[$cat_id]['cat_description']) ? htmlspecialchars(strip_tags(trim($cat_cache[$cat_id]['cat_description']))) . ". " "";

But I couldn't fix this problem. Please help me...

Best regards.

*****************************************************************************************************************************************

I've fixed this problem! Please change on step 3

Find in categories.php:
$site_template->register_vars(array('prepend_head_title' => $cat_cache[$cat_id]['cat_name'] . " - "));

Replace with:
$meta_description = !empty($cat_cache[$cat_id]['cat_description']) ? ($cat_cache[$cat_id]['cat_description']) . ". " "";
    
$meta_description preg_replace('/[\n\t\r]+/'' ',$meta_description);
    
$meta_keywords preg_replace("#[-_'`´\^\$\(\)<>\"\|,@\?%~\+\.\[\]{}:\/=!§\\\\]+#s"" "$meta_description);
    
    
$meta_keywords_array array_unique(explode(" ",$meta_keywords));
    
$meta_keywords "";
      foreach(
$meta_keywords_array as $val){
        
$len strlen($val);
        if (
$len >= 5) {
          
$meta_keywords .=  $val.", ";
        }
      } 

    
$site_template->register_vars(array(
      
"detail_meta_description"   => $meta_description,
      
"detail_meta_keywords"      => $meta_keywords,
      
"prepend_head_title"        => $cat_cache[$cat_id]['cat_name'] . " - "
      
));
« Last Edit: March 22, 2015, 10:20:55 PM by MorYeL »

Offline HeidiVargas

  • Pre-Newbie
  • Posts: 4
    • View Profile
Thank you ! for the Mod  :lol: