From: Timo Tijhof Date: Tue, 7 Jul 2015 10:32:03 +0000 (+0100) Subject: OutputPage: Only set on wiki/pages with variants X-Git-Tag: 1.31.0-rc.0~10854^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/?a=commitdiff_plain;h=208983b6d1f5383b4d58b31ca092e87605e05e0d;p=lhc%2Fweb%2Fwiklou.git OutputPage: Only set on wiki/pages with variants Follows-up 91d8a51825. Having the default variant advertised seems useful, however for wikis and/or pages that have no variants or translated versions, outputting this header doesn't seem useful. https://support.google.com/webmasters/answer/189077 doesn't justify sending it unconditionally. To try out, setting $wgLanguageCode = 'zh'; will result in all pages having hreflang=x-default and all variants. And setting to 'en' or 'de' will result in none of those link tags. Change-Id: I21cd072534ae1df960209e657b19c96889ece27c --- diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 0ed847e137..30ee19cc5a 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -3440,12 +3440,12 @@ class OutputPage extends ContextSource { 'href' => $this->getTitle()->getLocalURL( array( 'variant' => $_v ) ) ) ); } + # x-default link per https://support.google.com/webmasters/answer/189077?hl=en + $tags["variant-x-default"] = Html::element( 'link', array( + 'rel' => 'alternate', + 'hreflang' => 'x-default', + 'href' => $this->getTitle()->getLocalURL() ) ); } - # x-default link per https://support.google.com/webmasters/answer/189077?hl=en - $tags["variant-x-default"] = Html::element( 'link', array( - 'rel' => 'alternate', - 'hreflang' => 'x-default', - 'href' => $this->getTitle()->getLocalURL() ) ); } # Copyright