Jump to content

Extension talk:MetaKeywords

Add topic
From mediawiki.org
Latest comment: 12 years ago by Craig131 in topic All download links are dead at the moment.

Hello! What I need to change to make the same extension, but not by namespaces. I need different meta by categories.
--Tarasius.ua 17:02, 5 August 2010 (UTC)Reply

1.16.2

[edit]

I was able to get this to work with mediawiki 1.16.2 thusly:

--- MetaKeywords.php    2010-07-28 02:51:48.000000000 -0600
+++ /new/MetaKeywords.php        2011-04-05 20:04:38.000000000 -0600
@@ -43,7 +43,7 @@
 }
 
 //Adds customised keywords after the pagename of the <meta keywords> tag
-function wfMetaKeywordOutput( &$out ){
+function wfMetaKeywordOutput( $out ){
        global $wgTitle, $wgMemc;
        $ns = $wgTitle->getNamespace();
 
@@ -52,7 +52,7 @@
        if($opts === null ){ //Reload if not in cache
                $opts = wfMetaKeywordInput( 'keywords' );
        }
-       $pagename = array_shift( $out->mKeywords );
+       $pagename = $out->getPageTitle();
 
        if( array_key_exists( $ns, $opts ) && $opts[$ns] ){ //Namespace specific keywords
                array_unshift( $out->mKeywords, $opts[$ns]);
@@ -117,7 +117,7 @@
 }
 
 //Updates the cache if [[MediaWiki:Metakeywords]] or [[MediaWiki:Metadescription]] has been edited
-function wfMetaKeywordClearCache( &$article, &$wgUser, &$text ) {
+function wfMetaKeywordClearCache( $article, $wgUser, $text ) {
        global $wgMemc;
                $title = $article->mTitle;


Problem with 1.1.18?

[edit]

I just added this extension to my MediaWiki installation 1.1.18 and I now get the following error for lines 56, 58, 70, 72 when I view any page on my wiki. Any ideas?

Warning: array_key_exists() [function.array-key-exists]:
The second argument should be either an array or an object in /path/to/wiki/extensions/MetaKeywords/MetaKeywords.php on line 56

--Tanuki85 08:05, 5 December 2011 (UTC)Reply

[edit]

Couldn't even try this extension. However, the Description2 extension works great for meta descriptions on 1.19. Craig131 (talk) 07:21, 5 August 2012 (UTC)Reply

Version 1.22.6

[edit]

With Version 1.22.6 the description seems to work. The keywords don't show up, whwn you look at the sourcecode of the mainpage. Any explantion?

The debug infoermation says: Warning: array_shift() expects parameter 1 to be array, null given in /home/www/web64951/html/extensions/MetaKeywords/MetaKeywords.php on line 47

Warning: array_unshift() expects parameter 1 to be array, null given in /home/www/web64951/html/extensions/MetaKeywords/MetaKeywords.php on line 52

All the best from Dschermennie Bernd