From 208983b6d1f5383b4d58b31ca092e87605e05e0d Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Tue, 7 Jul 2015 11:32:03 +0100 Subject: [PATCH] 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 --- includes/OutputPage.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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 -- 2.20.1