[www-doc] [Git][VideoLAN.org/websites][master] add x-default link to localised index pages

Christoph Miebach gitlab at videolan.org
Wed Jan 18 11:11:50 CET 2017


Christoph Miebach pushed to branch master at VideoLAN organization / websites


Commits:
2a104e44 by Christoph Miebach at 2017-01-18T05:11:11-05:00
add x-default link to localised index pages

- - - - -


1 changed file:

- www.videolan.org/include/header.php


Changes:

=====================================
www.videolan.org/include/header.php
=====================================
--- a/www.videolan.org/include/header.php
+++ b/www.videolan.org/include/header.php
@@ -169,14 +169,21 @@ function start_head( $title,
             echo "<!-- ".$root_filename[0]." -->";
 
             foreach($alternate_lang as $lang) {
-                if( $lang == "en" )
+                if( $lang == "en" ) {
                     echo  '<link rel="alternate" hreflang="'.$lang.'" href="/'.$root_filename[0].'.html" />'."\n";
-                else
+                    /* we need a ref to v.o/ or v.o/vlc/  but use this header as well for i.e. vlc/download-windows.html
+                    * so, only place it if we are in a "index" file */
+                    if (strcasecmp(substr($root_filename[0], strlen($root_filename[0]) - 5),"index")===0) {
+                        echo  '<link rel="alternate" hreflang="x-default" href="/'.substr($root_filename[0], 0, -5).'" />'."\n";
+                    }
+                }
+                else {
                     /* hreflang probably requires - instead of _ this probably needs fixing
                     * ask google to include all those?
                     * http://www.w3.org/International/articles/bcp47/
                     */
                     echo  '<link rel="alternate" hreflang="'.$lang.'" href="/'.$root_filename[0].'.'.$lang.'.html" />'."\n";
+                }
             }
         }
         /* Common styles */



View it on GitLab: https://code.videolan.org/VideoLAN.org/websites/commit/2a104e44fc23e71e64492a5a48b9b8ab64fb8bd1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/www-doc/attachments/20170118/0880f4f4/attachment.html>


More information about the www-doc mailing list