Kipcool has submitted this change and it was merged.

Change subject: Removing "Expression:" from page title
......................................................................


Removing "Expression:" from page title

(test to see how it looks and if we like it)

Change-Id: I040fa02c986dac2df038cafaa3cc08d40f91c730
---
M Wikidata.hooks.php
1 file changed, 10 insertions(+), 1 deletion(-)

Approvals:
  Kipcool: Verified; Looks good to me, approved



diff --git a/Wikidata.hooks.php b/Wikidata.hooks.php
index 18c8741..d20b4a2 100644
--- a/Wikidata.hooks.php
+++ b/Wikidata.hooks.php
@@ -5,7 +5,7 @@
 class WikiLexicalDataHooks {
 
        public static function onBeforePageDisplay( $out, $skin ) {
-               global $wgLang, $wgScriptPath, $wgRequest, $wgResourceModules;
+               global $wgContLang;
 
                $out->addModules( 'ext.Wikidata.css' );
                $out->addModules( 'ext.Wikidata.ajax' );
@@ -13,6 +13,14 @@
                // for editing, but also needed in view mode when dynamically 
editing annotations
                $out->addModules( 'ext.Wikidata.edit' );
                $out->addModules( 'ext.Wikidata.suggest' );
+
+               // remove Expression: from title. Looks better on Google
+               $namespace = $skin->getTitle()->getNamespace();
+               if ( $namespace == NS_EXPRESSION ) {
+                       $namespaceText = $wgContLang->getNsText( $namespace );
+                       // cut the namespaceText from the title
+                       $out->setPageTitle( mb_substr( $out->getPageTitle(), 
mb_strlen( $namespaceText ) + 1 ) );
+               }
 
                return true;
        }
@@ -158,6 +166,7 @@
                return true;
        }
 
+
        public static function onSkinTemplateNavigation ( &$skin, &$links ) {
 
                // only for Expression and DefinedMeaning namespaces

-- 
To view, visit https://gerrit.wikimedia.org/r/90709
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I040fa02c986dac2df038cafaa3cc08d40f91c730
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikiLexicalData
Gerrit-Branch: master
Gerrit-Owner: Kipcool <[email protected]>
Gerrit-Reviewer: Kipcool <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to