From: Magnus Manske Date: Sat, 20 Mar 2004 13:27:08 +0000 (+0000) Subject: adding meta keywords X-Git-Tag: 1.3.0beta1~764 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/modifier.php?a=commitdiff_plain;h=e799a6d83a545a734d4bc8bff015033c9bf9226e;p=lhc%2Fweb%2Fwiklou.git adding meta keywords --- diff --git a/includes/Article.php b/includes/Article.php index ffce076944..d9fe1167f4 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -365,6 +365,9 @@ class Article { $wgOut->addWikiText( $text ); } + # Add link titles as META keywords + $wgOut->addMetaTags() ; + $this->viewUpdates(); wfProfileOut( $fname ); } diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 6552dd802c..b60bf26c08 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -542,6 +542,19 @@ class OutputPage { $wgOut->addHTML( "\n

$r\n" ); } + # This function takes the existing and broken links for the page + # and uses the first 10 of them for META keywords + function addMetaTags () + { + global $wgLinkCache , $wgOut ; + $good = array_keys ( $wgLinkCache->mGoodLinks ) ; + $bad = array_keys ( $wgLinkCache->mBadLinks ) ; + $a = array_merge ( $good , $bad ) ; + $a = array_slice ( $a , 0 , 10 ) ; # 10 keywords max + $a = implode ( "," , $a ) ; + $wgOut->addMeta ( "KEYWORDS" , $a ) ; + } + /* private */ function headElement() { global $wgDocType, $wgDTD, $wgUser, $wgLanguageCode, $wgOutputEncoding, $wgLang, $wgRequest;