David
This might sound a strange one and not achievable but is it possible to draw first x amount of words from product description to use in meta tag description.
Chris
Thank you David, just need to look and see if it will be benificial or not.
Chris
David
All working fine but seems to output any (text after filters) that may be placed after product description as extra text on page. Is there and way to exclude them or are we just pushing this too far.
Chris
Hi Chris,
I'm not totally sure what you mean here. Are you saying that the meta tag is appearing as you want; but then some other text is being generated elsewhere on the page as a result of this modification?
Cheers,
David.
Hi Chris,
I'll need to see this - can you email me (reply to your reg code or forum registration email) a link to a page on your site showing the problem and i'll take a look...
Cheers,
David.
How would the description appear in a search engine without this mod?
Also its meta title given the product title?
Keywords, whats enter in here?
Thanks
Hi,
It would depend on the search engine's interpretation of the meta tags as to what exactly appeared in the search results. I don't really know if any are using it for display purposes any more; however it may contribute towards search placement. The meta title tag is not used in place of the standard HTML title tag, and the keywords meta tag is also set to the product name.
Cheers,
David.
I have the script in my home directory. Can you show what code to add to setup the meta tags for just the index page.
title
Description
Keywords
Thanks
Hi,
In your index.php, look for the following line near the top:
require("html/header.php");
and change this to:
$header["meta"]["description"] = "Your description here";
$header["meta"]["keywords"] = "Your, Keywords, Here";
require("html/header.php");
To change the main title, edit $config_title in config.php.
Hope this helps!
Cheers,
David.
at the moment my product pages show meta descriptions and keywords, but not my homepage.
Is there a way I can setup an "if" so it knows its the home page and shows exactly the words I want it to?
thanks
Hi Mal,
The modification just above in this thread will let you show your choice of meta description and keywords on your homepage. There's no need for an IF statement, as the tags are controlled by setting the $header["meta"] array within index.php which is then picked up and displayed by html/header.php.
Cheers,
David.
Hi Chris,
Yes - that's doable. The description meta tag (for product pages) is currently set on line 52 of products.php as follows:
$header["meta"]["description"] = translate("Price search results for")." ".htmlentities($q,ENT_QUOTES,$config_charset);
To change this to use the first few words from the description, replace the above with the following block of code:
$description = $product["products"][0]["description"];
$breakLimit = 50;
if (strlen($description) > $breakLimit)
{
// find the first space after the limit
$breakOffset = strpos($description," ",$breakLimit);
// if found, crop the description
if ($breakOffset !== false)
{
$description = substr($description,0,$breakOffset);
}
}
$header["meta"]["description"] = $description;
The code strips out the first first n words of the description, breaking the string on the first SPACE character following the $breakLimit'th character. If you want more or less words (i've assumed an average of 5 letters per word, so 50 would give you about 10 words) simply change the value of $breakLimit in the code...
Hope this helps,
Cheers,
David.