Index: trunk/phase3/includes/OutputPage.php |
— | — | @@ -2895,28 +2895,29 @@ |
2896 | 2896 | ) ); |
2897 | 2897 | } |
2898 | 2898 | |
2899 | | - $lang = $this->getTitle()->getPageLanguage(); |
2900 | 2899 | |
2901 | 2900 | # Language variants |
2902 | | - if ( !$wgDisableLangConversion && $wgCanonicalLanguageLinks |
2903 | | - && $lang->hasVariants() ) { |
| 2901 | + if ( !$wgDisableLangConversion && $wgCanonicalLanguageLinks ) { |
| 2902 | + $lang = $this->getTitle()->getPageLanguage(); |
| 2903 | + if ( $lang->hasVariants() ) { |
2904 | 2904 | |
2905 | | - $urlvar = $lang->getURLVariant(); |
| 2905 | + $urlvar = $lang->getURLVariant(); |
2906 | 2906 | |
2907 | | - if ( !$urlvar ) { |
2908 | | - $variants = $lang->getVariants(); |
2909 | | - foreach ( $variants as $_v ) { |
| 2907 | + if ( !$urlvar ) { |
| 2908 | + $variants = $lang->getVariants(); |
| 2909 | + foreach ( $variants as $_v ) { |
| 2910 | + $tags[] = Html::element( 'link', array( |
| 2911 | + 'rel' => 'alternate', |
| 2912 | + 'hreflang' => $_v, |
| 2913 | + 'href' => $this->getTitle()->getLocalURL( '', $_v ) ) |
| 2914 | + ); |
| 2915 | + } |
| 2916 | + } else { |
2910 | 2917 | $tags[] = Html::element( 'link', array( |
2911 | | - 'rel' => 'alternate', |
2912 | | - 'hreflang' => $_v, |
2913 | | - 'href' => $this->getTitle()->getLocalURL( '', $_v ) ) |
2914 | | - ); |
| 2918 | + 'rel' => 'canonical', |
| 2919 | + 'href' => $this->getTitle()->getCanonicalUrl() |
| 2920 | + ) ); |
2915 | 2921 | } |
2916 | | - } else { |
2917 | | - $tags[] = Html::element( 'link', array( |
2918 | | - 'rel' => 'canonical', |
2919 | | - 'href' => $this->getTitle()->getCanonicalUrl() |
2920 | | - ) ); |
2921 | 2922 | } |
2922 | 2923 | } |
2923 | 2924 | |
— | — | @@ -2964,9 +2965,6 @@ |
2965 | 2966 | # like to promote instead of the RC feed (maybe like a "Recent New Articles" |
2966 | 2967 | # or "Breaking news" one). For this, we see if $wgOverrideSiteFeed is defined. |
2967 | 2968 | # If so, use it instead. |
2968 | | - |
2969 | | - $rctitle = SpecialPage::getTitleFor( 'Recentchanges' ); |
2970 | | - |
2971 | 2969 | if ( $wgOverrideSiteFeed ) { |
2972 | 2970 | foreach ( $wgOverrideSiteFeed as $type => $feedUrl ) { |
2973 | 2971 | // Note, this->feedLink escapes the url. |
— | — | @@ -2976,11 +2974,11 @@ |
2977 | 2975 | $this->msg( "site-{$type}-feed", $wgSitename )->text() |
2978 | 2976 | ); |
2979 | 2977 | } |
2980 | | - } elseif ( $this->getTitle()->getPrefixedText() != $rctitle->getPrefixedText() ) { |
| 2978 | + } elseif ( !$this->getTitle()->isSpecial( 'Recentchanges' ) ) { |
2981 | 2979 | foreach ( $wgAdvertisedFeedTypes as $format ) { |
2982 | 2980 | $tags[] = $this->feedLink( |
2983 | 2981 | $format, |
2984 | | - $rctitle->getLocalURL( "feed={$format}" ), |
| 2982 | + $this->getTitle()->getLocalURL( "feed={$format}" ), |
2985 | 2983 | $this->msg( "site-{$format}-feed", $wgSitename )->text() # For grep: 'site-rss-feed', 'site-atom-feed'. |
2986 | 2984 | ); |
2987 | 2985 | } |