Support Forums

Customized meta 'title' for viewlisting

This is a discussion on Customized meta 'title' for viewlisting within the Modules / Plugins / Modifications forums, part of the Developer Forums category; Hi I'd like to display in the <title> tag the following infos : title of the listing ( name of ...


Go Back   68 Classifieds Forums > Developer Forums > Modules / Plugins / Modifications

Reply
 
Thread Tools Display Modes
Old 09-06-2008, 03:23 AM   #1
Customer
 
 
Join Date: Mar 2006
Location: Lille (France)
Posts: 112
Rep Power: 23
frommarcq is on a distinguished road
Smile Customized meta 'title' for viewlisting

Hi
I'd like to display in the <title> tag the following infos :
title of the listing (name of the category from title of the website).
I think it would be better for the SEO, instead of 'title of the website >> title of the listing, and the add of the category name will help...
What do I have to change in viewlisting.php ?
Thanks
Pascal
__________________
68classifieds (V4.2.1 Developer)
frommarcq is offline   Reply With Quote
Old 09-06-2008, 04:47 AM   #2
All Hands On Deck
 
 
Join Date: Mar 2008
Posts: 3,148
Rep Power: 77
seymourjames is a jewel in the rough
Default

You will get the idea here.

A sample from my site which I place in the header of the layout.tpl file along with tests for every type of page for that matter. I use the category in the description but you could eqaully put it in the title. I assign new variables because Ialso use them in the body of a page sometimes.

{if $SCRIPT_NAME == "/viewlisting.php"}
{foreach name=outer item=contact from=$breadcrumb}
{foreach item=item from=$contact}
{assign var=category value=$item|strip_tags}
{/foreach}
{/foreach}
{assign var=newtitle value="$title"}
{assign var=desc value="A wonderful French property - $newtitle for sale"}
<meta name="Keywords" content="{$category},house,property,france,french, for sale" />
<title>{$newtitle}</title>
<meta name="Description" content="{$desc}" />

see also http://www.68classifieds.com/forums/...meta-tags.html

You might like to consider our SEO services for doing a whole site.
__________________
"The fool doth think he is wise, but the wise man knows himself to be a fool.".

TemplateCodes.com for 68C, Version 4 Templates and list your 68C site on ClassifiedCodes.com
seymourjames is offline   Reply With Quote
Old 09-16-2008, 09:03 AM   #3
Junior Member
 
Join Date: Aug 2008
Posts: 3
Rep Power: 0
rembrandt is on a distinguished road
Default

Quote:
Originally Posted by seymourjames
You will get the idea here.

A sample from my site which I place in the header of the layout.tpl file along with tests for every type of page for that matter. I use the category in the description but you could eqaully put it in the title. I assign new variables because Ialso use them in the body of a page sometimes.

{if $SCRIPT_NAME == "/viewlisting.php"}
{foreach name=outer item=contact from=$breadcrumb}
{foreach item=item from=$contact}
{assign var=category value=$item|strip_tags}
{/foreach}
{/foreach}
{assign var=newtitle value="$title"}
{assign var=desc value="A wonderful French property - $newtitle for sale"}
<meta name="Keywords" content="{$category},house,property,france,french, for sale" />
<title>{$newtitle}</title>
<meta name="Description" content="{$desc}" />
Thanks for this. I managed to get this working on the view listings but now wondering how I can do the same thing to the category lists.
rembrandt is offline   Reply With Quote
Old 09-16-2008, 10:24 AM   #4
All Hands On Deck
 
 
Join Date: Mar 2008
Posts: 3,148
Rep Power: 77
seymourjames is a jewel in the rough
Default

Well done. If you got the viewlisting working you should be able to do this.

You will have to modify for your liking. Note I test for page 1. If you go to my site and click on a subcategory you will see why. I use the newtitle and desc variables for the title and meta description later on in the script (makes the logoc easier). I do it like this so I can use them in the body of the text as well. You could assign them directly. I make $pagetitle to trim the spaces which are in $category variable or the formatting is not so nice. Hope this helps.

{if $SCRIPT_NAME == "/category.php"}
{if empty($breadcrumb)}
{assign var=newtitle value="French Properties For Sale"}
{assign var=desc value="Property in France including French properties in South France, South West France, West France, East France, North France, Central France and Corsica"}
<meta name="Keywords" content="property south france,property south west france,property west france,property east france,property north france,property central france,property corsica,french,property,france" />
{else}
{foreach name=outer item=contact from=$breadcrumb}
{foreach item=item from=$contact}
{assign var=category value=$item|strip_tags}
{/foreach}
{/foreach}
{assign var=pagetitle value=$category|trim}
{if $pageNum == 1}
{assign var=newtitle value=$pagetitle}
{assign var=desc value="$sitedescription"}
{else}
{assign var=newtitle value="$pagetitle $pageNum"}
{assign var=desc value="$sitedescription $pageNum"}
{/if}
<meta name="Keywords" content="{$sitekeywords}" />

.
.
.

<title>{$newtitle}</title>
<meta name="Description" content="{$desc}" />




Notice also that I have modified the showlistings pagination (look at a live page) to make it simpler. It avoids duplicate problems. You may like to go back to your viewlistings and use the trim operator with newtitle, desc etc. You have more control that way over the formatting (avoids spurious spaces - you can see these if you look at the source code generated with my viewlistings code which I have now modified).
__________________
"The fool doth think he is wise, but the wise man knows himself to be a fool.".

TemplateCodes.com for 68C, Version 4 Templates and list your 68C site on ClassifiedCodes.com
seymourjames is offline   Reply With Quote
Old 09-17-2008, 07:10 AM   #5
Junior Member
 
Join Date: Aug 2008
Posts: 3
Rep Power: 0
rembrandt is on a distinguished road
Default

seymourjames... your a legend. That was exactly what I was looking for and worked a treat. Fixing the titles on the site pages is definitely going to make a difference in the number of indexed pages on my site. I really appreciate your help.

Last edited by rembrandt; 09-17-2008 at 07:11 AM. Reason: forgot to add something
rembrandt is offline   Reply With Quote
Old 09-17-2008, 03:10 PM   #6
All Hands On Deck
 
 
Join Date: Mar 2008
Posts: 3,148
Rep Power: 77
seymourjames is a jewel in the rough
Default

No problem. Glad to help. Hope you used the idea of assigning new variables. It makes the logic simpler as you just assign your title and metatags once, right at the end of a block of if-else statements and secondly you can easily use those variables in the body of the page as well - a good SEO practice. The important thing is to also make sure that internal links to pages use appropriate titles in the a href as well. This can be tricky but it is possible to do - it places a few restrictions on what you can assign (depends upon which variables are available to which script). If you would like the full logic for all the usual types of pages, then PM me with your email and I will send it to you. It is possible to do for the login page, categories, search, etc, etc.
__________________
"The fool doth think he is wise, but the wise man knows himself to be a fool.".

TemplateCodes.com for 68C, Version 4 Templates and list your 68C site on ClassifiedCodes.com
seymourjames is offline   Reply With Quote
Old 10-01-2008, 05:46 AM   #7
Customer
 
 
Join Date: Mar 2006
Location: Lille (France)
Posts: 112
Rep Power: 23
frommarcq is on a distinguished road
Thumbs up

David,
Sorry for my late answer, but my life is a real race !!!
I've tested your suggestion yesterday : it works great !!!
I think it will help in the SEO...
Thanks a lot !
Pascal
__________________
68classifieds (V4.2.1 Developer)
frommarcq is offline   Reply With Quote
Old 10-15-2008, 05:22 PM   #8
Senior Member
 
Join Date: Apr 2007
Posts: 100
Rep Power: 19
jj30 is on a distinguished road
Default

Hi

I am trying to follow this code, but dont seem to find it anywhere and which file it does it go in.

Viewed code on your home page, dont seem to see it.

Could you put me out of my misery, and give me a clue.

Thanks
jj30 is offline   Reply With Quote
Old 10-16-2008, 05:44 AM   #9
All Hands On Deck
 
 
Join Date: Mar 2008
Posts: 3,148
Rep Power: 77
seymourjames is a jewel in the rough
Default

It is my code and does not exist anywhere in the standard script. It does say where to place it in the thread.

You place the code in the head portion of your layout.tpl file. Do not forget to take care in getting the right opening and closing if-statements - just dumping this code in as it is may not work for you.
__________________
"The fool doth think he is wise, but the wise man knows himself to be a fool.".

TemplateCodes.com for 68C, Version 4 Templates and list your 68C site on ClassifiedCodes.com
seymourjames is offline   Reply With Quote
Old 10-16-2008, 05:45 AM   #10
All Hands On Deck
 
 
Join Date: Mar 2008
Posts: 3,148
Rep Power: 77
seymourjames is a jewel in the rough
Default

Many thanks Marq for your kind words.
__________________
"The fool doth think he is wise, but the wise man knows himself to be a fool.".

TemplateCodes.com for 68C, Version 4 Templates and list your 68C site on ClassifiedCodes.com
seymourjames is offline   Reply With Quote
Reply

Thread Tools
Display Modes



All times are GMT -4. The time now is 01:56 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2011, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0