[www-doc] [Git][VideoLAN.org/websites][master] 4 commits: header: fix language tags and hreflang links

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Wed Nov 4 07:09:38 UTC 2026



Jean-Baptiste Kempf pushed to branch master at VideoLAN organization / websites


Commits:
8a5649ac by Martin Finkel at 2026-11-04T12:58:44+07:00
header: fix language tags and hreflang links

Google ignores relative hreflang URLs and needs each page to list
itself. Use absolute https URLs, list the English page, and use BCP 47
tags (pt-BR) instead of gettext locale names (pt_BR) in hreflang and
the html lang attribute.

- - - - -
03eb63d3 by Martin Finkel at 2026-11-04T12:58:52+07:00
header: add a canonical link to generated English pages

Without one, Google may index the http:// or index.html copy of a page,
as it currently does for www.videolan.org/vlc/. Translated pages get
none, as nginx may serve them at the English URL.

- - - - -
9a410453 by Martin Finkel at 2026-11-04T12:59:09+07:00
index: declare the site name

Google currently shows "VLC: Sitio oficial" as the site name, taken
from the Spanish home page title. Declare it with WebSite structured
data.

- - - - -
84bdb6fa by Martin Finkel at 2026-11-04T12:59:16+07:00
header: add a 192x192 favicon

The only favicon is 16x16, below the 48x48 minimum Google needs to show
one in search results. Render one from images/icons-VLC/vlc.mini.svg.

- - - - -


3 changed files:

- + www.videolan.org/images/favicon-192.png
- www.videolan.org/include/header.php
- www.videolan.org/index.php


Changes:

=====================================
www.videolan.org/images/favicon-192.png
=====================================
Binary files /dev/null and b/www.videolan.org/images/favicon-192.png differ


=====================================
www.videolan.org/include/header.php
=====================================
@@ -141,7 +141,7 @@ function start_head( $title,
     }
 ?>
     <!DOCTYPE html>
-    <html lang="<?php echo $language?>" <?php if ( isRTL( $language ) ) { echo ' dir="rtl"'; } ?>>
+    <html lang="<?php echo str_replace('_', '-', $language)?>" <?php if ( isRTL( $language ) ) { echo ' dir="rtl"'; } ?>>
     <head>
         <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
         <?php if ($new_design): ?>
@@ -159,6 +159,13 @@ function start_head( $title,
         <meta name="apple-itunes-app" content="app-id=650377962"/>
         <title><?php echo _( $title ); ?> - VideoLAN</title>
 
+        <?php /* Only on English pages generated by bin/php-cgi.sh */
+        if( $_SERVER['SERVER_SOFTWARE'] == "Shell CGI/0.1" && $language == "en" ) {
+            $page = substr( $_SERVER['SCRIPT_NAME'], 0, -4 );
+            $page = basename( $page ) == "index" ? substr( $page, 0, -5 ) : $page.'.html';
+            echo  '<link rel="canonical" href="https://www.videolan.org/'.$page.'" />'."\n";
+        } ?>
+
         <?php /* Additional Meta */
             if( isset($additional_meta) ) {
             foreach($additional_meta as $meta) {
@@ -168,6 +175,7 @@ function start_head( $title,
 
         <?php /* Favicon */ ?>
         <link rel="shortcut icon" type="image/x-icon" href="//images.videolan.org/images/favicon.ico" />
+        <link rel="icon" type="image/png" sizes="192x192" href="//images.videolan.org/images/favicon-192.png" />
 
         <?php /* RSS */ ?>
         <link rel="alternate" type="application/rss+xml" title="RSS - VideoLAN News" href="//images.videolan.org/videolan-news.rss" />
@@ -175,25 +183,23 @@ function start_head( $title,
 
         <?php
         /* Alternate */
-        if( isset($alternate_lang) ) {
+        if( count($alternate_lang) > 0 ) {
             $root_filename = explode('.', $_SERVER['SCRIPT_NAME'] );
             echo "<!-- ".$root_filename[0]." -->"."\n";
 
-            foreach($alternate_lang as $lang) {
+            foreach(array_merge(array("en"), $alternate_lang) as $lang) {
                 if( $lang == "en" ) {
-                    echo  '        <link rel="alternate" hreflang="'.$lang.'" href="/'.$root_filename[0].'.html" />'."\n";
+                    $en_url = 'https://www.videolan.org/'.$root_filename[0].'.html';
                     /* 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";
+                        $en_url = 'https://www.videolan.org/'.substr($root_filename[0], 0, -5);
+                        echo  '        <link rel="alternate" hreflang="x-default" href="'.$en_url.'" />'."\n";
                     }
+                    echo  '        <link rel="alternate" hreflang="en" href="'.$en_url.'" />'."\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";
+                    echo  '        <link rel="alternate" hreflang="'.str_replace('_', '-', $lang).'" href="https://www.videolan.org/'.$root_filename[0].'.'.$lang.'.html" />'."\n";
                 }
             }
         }


=====================================
www.videolan.org/index.php
=====================================
@@ -18,6 +18,16 @@ include($_SERVER["DOCUMENT_ROOT"] . "/include/magpierss/rss_fetch.inc");
 /* Main page */
 ?>
 
+<script type="application/ld+json">
+{
+    "@context": "https://schema.org",
+    "@type": "WebSite",
+    "name": "VideoLAN",
+    "alternateName": ["VLC", "VLC media player"],
+    "url": "https://www.videolan.org/"
+}
+</script>
+
 <div class="container">
     <?php drawVLCdownloadSection(); ?>
 </div>



View it on GitLab: https://code.videolan.org/VideoLAN.org/websites/-/compare/7e57bdda0615cdbe91dc24268f0eb8371858e450...84bdb6fa45fc87c65e511a52f0e5e1c380149095

-- 
View it on GitLab: https://code.videolan.org/VideoLAN.org/websites/-/compare/7e57bdda0615cdbe91dc24268f0eb8371858e450...84bdb6fa45fc87c65e511a52f0e5e1c380149095
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help




More information about the www-doc mailing list