|
Forums ⇒ Miscellaneous ⇒ Search Engines ⇒ A Meta Tags enhancement I made for news
A Meta Tags enhancement I made for newsQuestions and issues with search engines, SEO, bots, meta tags.
Go to page 1, 2 Next
|
View previous topic :: View next topic |
| Author |
Message |
spacebar Dragonfly addicted


Offline Joined: Sep 28, 2005 Posts: 413 Location: Providence
|
Posted: Wed Oct 03, 2007 8:19 pm Post subject: A Meta Tags enhancement I made for news |
|
I added the following to my news module's article.php file.
The code needs to be before the line:
require_once('header.php');
What it does is dynamically generate the keywords and description header tags with data from the article instead of the current same info for every page.
For me its working well. Thought I'd share.
If you have any suggestions or see any flaws, please say so.
| Code:: |
//Process Meta Tags
//hack by spacebar for GotPoetry.com
//09/15/2007
//Generate dynamic description
$order = array("\r\n", "\n", "\r");
$replace = ' ';
// Processes \r\n's first so they aren't converted twice.
$new_desc = str_replace($order, $replace,strip_tags($hometext));
$order = array('"');
$replace = ' ';
// Processes " so tags work.
$new_keywords = str_replace($order, $replace,$new_desc);
$METATAGS['description'] = substr($new_keywords,0,255);
//Generate dynamic keywords
$new_keywords = " ".$new_keywords." ";
$new_keywords = strtolower("article news story " . $story['cattitle'] . " " . $story['title'] . " " . $new_keywords);
//Remove common words
$order = array(" a "," about "," after "," against "," all "," almost "," also "," am "," an "," and "," another "," any "," are "," around "," as "," at "," b "," be "," because "," been "," before "," behind "," being "," both "," but "," by "," c "," came "," come "," comes "," could "," d "," did "," do "," does "," done "," e "," each "," either "," etc "," ever "," every "," example "," f "," few "," for "," from "," g "," go "," h "," had "," has "," have "," here "," how "," however "," i "," if "," ii "," iii "," in "," include "," included "," including "," into "," is "," it "," its "," iv "," ix "," j "," just "," k "," l "," m "," many "," may "," midst "," might "," my "," n "," nbsp "," neither "," never "," next "," no "," nor "," not "," now "," o "," of "," often "," on "," once "," or "," other "," others "," our "," over "," p "," put "," q "," r "," s "," same "," shall "," should "," since "," so "," some "," something "," sometimes "," soon "," such "," t "," than "," that "," the "," their "," them "," then "," there "," these "," they "," this "," those "," through "," to "," too "," toward "," u "," under "," underneath "," until "," us "," use "," used "," uses "," using "," usually "," v "," very "," vi "," vii "," viii "," w "," was "," we "," went "," were "," what "," when "," where "," whether "," which "," while "," who "," why "," with "," within "," without "," would "," x "," xi "," xii "," xiii "," xiv "," xix "," xv "," xvi "," xvii "," xviii "," xx "," y "," you "," your "," z ");
$replace = ' ';
$new_keywords = str_replace($order, $replace,$new_keywords);
//remove duplicate words
$new_keywords = preg_replace("/([,.?!])/"," \\1",$new_keywords);
$parts = explode(" ",$new_keywords);
$unique = array_unique($parts);
$unique = implode(" ",$unique);
$unique_keywords = preg_replace("/\s([,.?!])/","\\1",$unique);
//Remove punctuation, etc
$order = array(" "," ",",",".",":",":","!","(",")");
$unique_keywords = str_replace($order, " ",$unique_keywords);
//make CSV list
$order = array(" ");
$replace = ',';
$unique_keywords = str_replace($order, $replace,$unique_keywords);
$unique_keywords = str_replace(",,", ",",$unique_keywords);
if (substr($unique_keywords,0,1) == ",") {
$unique_keywords = substr($unique_keywords,1);
}
if (strlen($unique_keywords) > 5) {
$METATAGS['keywords'] = $unique_keywords;
} |
_________________

spacebar's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Unix / 2.0.46 (Red Hat) / 0.9.7a / 4.1.9-standard / 4.3.2 / 9.0.6.1
|
|
| Back to top |
|
 |
PoKo Supporter


Offline Joined: Aug 28, 2005 Posts: 148
|
Posted: Sat Oct 06, 2007 2:25 pm Post subject: Re: A Meta Tags enhancement I made for news |
|
Does this output a max number of keywords?
Will it grab keywords from the entire article or just from the ingress?
I just don't want google to ban me for spamming keywords...
I have been wanting something like this so if it works well I'm happy
PoKo's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Linux 2.4.28 - Linux srv60 2.6.12.6 / Apache / 4.0.22 - 4.1.22 - 5.0.22 -5.0.32 / 4.3.11 - 4.4.2 - 4.4.4 - 5.2.5 / 9.0.6.1 - 9.1.2.1 - 9.2.0.RC2
|
|
| Back to top |
|
 |
PoKo Supporter


Offline Joined: Aug 28, 2005 Posts: 148
|
Posted: Sat Oct 06, 2007 2:52 pm Post subject: Re: A Meta Tags enhancement I made for news |
|
Tried it and all I got from it was a direct copy of the title line as a keyword line. Won't google be searching the title line anyway when searching for keywords?
PoKo's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Linux 2.4.28 - Linux srv60 2.6.12.6 / Apache / 4.0.22 - 4.1.22 - 5.0.22 -5.0.32 / 4.3.11 - 4.4.2 - 4.4.4 - 5.2.5 / 9.0.6.1 - 9.1.2.1 - 9.2.0.RC2
|
|
| Back to top |
|
 |
spacebar Dragonfly addicted


Offline Joined: Sep 28, 2005 Posts: 413 Location: Providence
|
Posted: Sun Oct 07, 2007 2:43 am Post subject: Re: A Meta Tags enhancement I made for news |
|
| PoKo wrote: |
| Tried it and all I got from it was a direct copy of the title line as a keyword line. Won't google be searching the title line anyway when searching for keywords? |
The code takes your title plus your category name plus the entire article and removes the duplicates plus the common words. So do you have text in your article?
Give me a URL and I'll take a look.
I don't think Google will ban your for keyword spamming because your article has all of the keywords you use in it. Does anyone else know otherwise?
_________________

spacebar's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Unix / 2.0.46 (Red Hat) / 0.9.7a / 4.1.9-standard / 4.3.2 / 9.0.6.1
|
|
| Back to top |
|
 |
PoKo Supporter


Offline Joined: Aug 28, 2005 Posts: 148
|
Posted: Mon Oct 08, 2007 9:09 pm Post subject: Re: A Meta Tags enhancement I made for news |
|
Sorry - I removed everything again right after testing it. My site is in norwegian so I had to change all the words into norwegian and I didn't save it. I'll see if I can do it again in a few days.
Anyway, I didn't get any content from the article in the meta tags except from what was in the article header and as you said the category name.
On the other note I have read so many times about google (and others) banning sites that uses too many key words, so this is infact maybe a good thing. If this script should work perfectly it should get keywords from the ingress part of the article only, and limmit it to max 10 words, imo since I do belive that search engines will also index the title line as it is.
PoKo's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Linux 2.4.28 - Linux srv60 2.6.12.6 / Apache / 4.0.22 - 4.1.22 - 5.0.22 -5.0.32 / 4.3.11 - 4.4.2 - 4.4.4 - 5.2.5 / 9.0.6.1 - 9.1.2.1 - 9.2.0.RC2
|
|
| Back to top |
|
 |
Phoenix • Many Posts •


Offline Joined: Apr 19, 2004 Posts: 8799 Location: Netizen
|
Posted: Mon Oct 08, 2007 11:41 pm Post subject: Re: A Meta Tags enhancement I made for news |
|
IMO spacebar is on safe ground as far as Google penalties go.
Unlike some search engines, Google no longer uses meta keywords as a major determinant of page ranking. However, it does use them to determine spamming penalties, if keywords do not appear in page content. However, the search engines do ignore or reduce the weight of a given keyword if there are excessive keywords present.
In terms of adsense, I am not aware of any penalties from spacebar's practice. In terms of your site's SEO, I could not recommend excessive use of keywords - it will hurt you in search engine page assessments.
In summary, I think you make a choice between attracting more relevant ads and reducing your site's appeal to search engines, but remember, spacebar is only doing this on a News article basis.
A possible enhancement would be to ignore words stored in the forums stopwords list (and add to that list), plus simply ignore any word with 3 characters or less, much like the forums search function.
Note: a very useful topic and discussion, so moved to "Search Engines" forum.
Phoenix's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
|
|
| Back to top |
|
 |
spacebar Dragonfly addicted


Offline Joined: Sep 28, 2005 Posts: 413 Location: Providence
|
Posted: Tue Oct 09, 2007 2:46 am Post subject: Re: A Meta Tags enhancement I made for news |
|
| Quote:: |
| A possible enhancement would be to ignore words stored in the forums stopwords list (and add to that list), plus simply ignore any word with 3 characters or less, much like the forums search function. |
Could someone explain what the forum's stopwords list does?
I can certainly make both of these changes. Should the number of keywords be limited to a lesser number?
_________________

spacebar's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Unix / 2.0.46 (Red Hat) / 0.9.7a / 4.1.9-standard / 4.3.2 / 9.0.6.1
|
|
| Back to top |
|
 |
spacebar Dragonfly addicted


Offline Joined: Sep 28, 2005 Posts: 413 Location: Providence
|
Posted: Tue Oct 09, 2007 3:05 am Post subject: Re: A Meta Tags enhancement I made for news |
|
"forums stopwords list (and add to that list)"
I've been looking into this and realize I don't know what table this is or how to reference it.
_________________

spacebar's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Unix / 2.0.46 (Red Hat) / 0.9.7a / 4.1.9-standard / 4.3.2 / 9.0.6.1
|
|
| Back to top |
|
 |
Phoenix • Many Posts •


Offline Joined: Apr 19, 2004 Posts: 8799 Location: Netizen
|
Posted: Tue Oct 09, 2007 3:06 am Post subject: Re: A Meta Tags enhancement I made for news |
|
The forums stopwords list can be found in,
language/your_lang/Forums/search_stopwords.txt
It is used by,
modules/Forums/search.php
includes/phpBB/functions_search.php
Essentially it is matched against any words used in a search to preclude those words being added to the cms_bbsearch_wordlist table.
You may find the code in those files handy for adapting something.
Keywords limit? Personally yes, but you will get as many answers as there are SEO experts as to how many - anywhere between 10 and 30, but I would lean towards the lower end of the range, like 15. In your case it is not critical for the reasons I explained above.
Phoenix's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
|
|
| Back to top |
|
 |
PoKo Supporter


Offline Joined: Aug 28, 2005 Posts: 148
|
Posted: Wed Oct 10, 2007 9:17 am Post subject: Re: A Meta Tags enhancement I made for news |
|
| Phoenix wrote: |
| However, it does use them to determine spamming penalties, if keywords do not appear in page content |
So when the module names are beeing used as keywords, (News, articles) and the article does not use these words at all, then it can be thought of as spamming, is that what you are saying?
I am asking since spacebar made this script add the module name as the first keyword before adding the "real" kaywords from the article...
PoKo's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Linux 2.4.28 - Linux srv60 2.6.12.6 / Apache / 4.0.22 - 4.1.22 - 5.0.22 -5.0.32 / 4.3.11 - 4.4.2 - 4.4.4 - 5.2.5 / 9.0.6.1 - 9.1.2.1 - 9.2.0.RC2
|
|
| Back to top |
|
 |
Phoenix • Many Posts •


Offline Joined: Apr 19, 2004 Posts: 8799 Location: Netizen
|
Posted: Wed Oct 10, 2007 9:43 am Post subject: Re: A Meta Tags enhancement I made for news |
|
Even if those words were not somewhere on the page, a couple of words hardly qualifies as keyword spam. The penalties are applied for people where there is obvious keyword stuffing totally unrelated to content.
I think spacebar's hack is quite clever and meritorious.
Phoenix's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
|
|
| Back to top |
|
 |
PoKo Supporter


Offline Joined: Aug 28, 2005 Posts: 148
|
Posted: Mon Oct 15, 2007 10:33 am Post subject: Re: A Meta Tags enhancement I made for news |
|
| Phoenix wrote: |
I think spacebar's hack is quite clever and meritorious. |
I agree on that one!
I would love to see something like this for other modules as well, like forums, coppermine etc if done right.
PoKo's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Linux 2.4.28 - Linux srv60 2.6.12.6 / Apache / 4.0.22 - 4.1.22 - 5.0.22 -5.0.32 / 4.3.11 - 4.4.2 - 4.4.4 - 5.2.5 / 9.0.6.1 - 9.1.2.1 - 9.2.0.RC2
|
|
| Back to top |
|
 |
spacebar Dragonfly addicted


Offline Joined: Sep 28, 2005 Posts: 413 Location: Providence
|
Posted: Fri Nov 16, 2007 3:03 am Post subject: Re: A Meta Tags enhancement I made for news |
|
I'm getting really good and relevant google ads in my site since I implemented this hack.
I put this type of hack into my news and poetry modules and I'm now getting really good and relevant google ads and various web search types of hits now.
I'd say its a successful exercise.
_________________

spacebar's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Unix / 2.0.46 (Red Hat) / 0.9.7a / 4.1.9-standard / 4.3.2 / 9.0.6.1
|
|
| Back to top |
|
 |
Jeruvy Security Team


Offline Joined: Apr 23, 2004 Posts: 1432 Location: Canada
|
Posted: Wed Nov 21, 2007 1:54 am Post subject: Re: A Meta Tags enhancement I made for news |
|
Excellent good to know.
_________________ J.
j e r u v y a t y a h o o d o t c o m
Need help? Look here: www.dragonflycms.org/W...d=112.html
Need to chat? Look for me on irc.freenode.net
Jeruvy's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Ubuntu7.10/Debian3.1 - 2.2.3/1.3.37 - 5.0.38/4.0.27 - 5.2.1/4.4.7 - CVS/9.1.2}
|
|
| Back to top |
|
 |
hqccg Newbie


Offline Joined: Nov 15, 2007 Posts: 20 Location: Colombia
|
Posted: Sat Feb 02, 2008 1:24 pm Post subject: Re: A Meta Tags enhancement I made for news |
|
I like this but I dont now where to put it I think its article.php in the news module am I correct please let me know before I kill my site.
_________________ Richard Hart
CMS Version 9.2.1
PHP Version 5.2.8
MySQL Version 4.1.22-max-log (client: 5.0.45)
hqccg's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) CMS Version 9.2.1/PHP Version 5.2.8/MySQL Version 4.1.22-max-log (client: 5.0.45)
|
|
| Back to top |
|
 |
|
|
All times are GMTGo to page 1, 2 Next
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|