Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Dynamic Meta Tags

Quote Reply
Dynamic Meta Tags
I have too many subdirectories to hand code the meta tags. Is there a links-tag I can use to replace the (%meta_keywords%) that will produce the path with commas instead of colons? (and without underscore spacers)

Example:
meta name="keywords" content="“Site Name, Support Groups, Computers, LinksSQL Anonymous”

Since so many of the search engines now index meta keywords, this seems like the easiest way to have keywords included on all the categories when the pages are built.

I am willing to tackle this if someone could offer a little guidance. Seems that others with large databases would be interested in doing this also.

As for the meta descriptions… well I haven’t come up with an answer for that, but I am open to all suggestions.
Wink
Quote Reply
Re: [jgkiefer] Dynamic Meta Tags In reply to
I'm guessing you can create an entry in globals.txt that gets meta_keywords (or whatever contains the path), replaces all colons with commas, and underscores with spaces.

I haven't played with Links (SQL) much, so I can't help much more than that Crazy. Hope this gives you a start.

Adrian
Quote Reply
Re: [brewt] Dynamic Meta Tags In reply to
I am guessing that I can use the (%title_linked%) tag? But how to change the colons to commas, and replace the underscores with spaces? I would welcome some insight on how to do this.

I think I have come up with a solution for the meta description. Maybe use the (%name%) tag to insert the category name in the meta description field. Does this sound like it would work?

Given the fact that search engines check the relevancy of the page content against the meta information, and rank the page accordingly, this should work really well. At least in theory. But can I get the code right is still the hurdle, since by no long stretch of the imagination am I a programmer. Unsure

Quote Reply
Re: [jgkiefer] Dynamic Meta Tags In reply to
Good news and bad news.

The good news is that by hard coding the (%title%) tag into the meta description field all is so good. Works perfect.

Bad news is - I can’t seen to get the keywords meta tag to work out. I tried hard coding in the (%category_name_escaped%) tag but it puts in o/o20 (o/o=%) for the spaces. Anyone know how I can modify this tag to leave a space when it gets printed, and insert a coma between category names?

So close and yet so far... Frown

Quote Reply
Re: [jgkiefer] Dynamic Meta Tags In reply to
it's an escaped version of category_name which means all non alphanumeric and a few other characters are converted to those codes. <%category_name%> is the same as it except it's not escaped.

I'm assuming you want to do something like:
globals.txt:
'meta_content' => 'sub {
my $vars = shift;
my $cat = $vars->{category_name};
$cat =~ s|/|, |g;
return $cat;
}'

so if the categories were:
Home : Hardware Sites : PC
then it would return:
Hardware Sites, PC
when you used <%meta_content%>...

Adrian
Quote Reply
Re: [brewt] Dynamic Meta Tags In reply to
That's exactly waht I was looking for! I will try it out and see how it works out.

Thank you-

Jeff
Quote Reply
Re: [brewt] Dynamic Meta Tags In reply to
Hi
The sub you gave :

'sub {
my $vars = shift;
my $cat = $vars->{category_name};
$cat =~ s|/|, |g;
return $cat;
}'

works fine ..
Any suggestion on how to create a global that will display all subcategories for a specific category separated by , and unlinked. (a simple list)?


Regards
KaTaBd

Users plug In - Multi Search And Remote Search plug in - WebRing plug in - Muslims Directory
Quote Reply
Re: [katabd] Dynamic Meta Tags In reply to
Code:
'list_of_categories' => 'sub {
my $vars = shift;
# category_loop contains the records of all the categories in this sub category.
my $categories = $vars->{category_loop};
# category_loop is an array of hashref's of the records, so we'll grab the
# Name field from all the categories using map and join them together.
my $cat = join(", ", map { $_->{Name} } @$categories);
return $cat;
}'
something like that Tongue

You'll have to comment out:
Code:
# Remove the root category, was only used for the print_cat function.
# shift @{$display{category_loop}};

on line ~580 (Build.pm) as it seems there root category has already been removed from the loop.


Adrian

Last edited by:

brewt: Sep 26, 2001, 10:46 PM