gnucash-htdocs beta: Multiple changes pushed

Frank H.Ellenberger fell at code.gnucash.org
Mon Oct 5 23:36:37 EDT 2020


Updated	 via  https://github.com/Gnucash/gnucash-htdocs/commit/384d4452 (commit)
	 via  https://github.com/Gnucash/gnucash-htdocs/commit/66bd62b2 (commit)
	 via  https://github.com/Gnucash/gnucash-htdocs/commit/062affde (commit)
	from  https://github.com/Gnucash/gnucash-htdocs/commit/70167aa8 (commit)



commit 384d4452915f96ada57d011d30b100aceacb367b
Author: Frank H. Ellenberger <frank.h.ellenberger at gmail.com>
Date:   Tue Oct 6 02:53:48 2020 +0200

    Disable bitrotten languages in lang.php:$supported_languages

diff --git a/lang.php b/lang.php
index 0738470..c07e832 100644
--- a/lang.php
+++ b/lang.php
@@ -31,10 +31,20 @@ if (array_key_exists('lang', $_GET)) { $locale = $_GET["lang"]; }
 # key: locale, value: lang_dir
 $supported_languages = array(
         'ca_ES' => 'ca',
-        'de_DE' => 'de', 'es_ES' => 'es', 'fr_FR' => 'fr', 'hr_HR' => 'hr',
-        'hu_HU' => 'hu', 'it_IT' => 'it', 'ja_JP' => 'ja', 'nb_NO' => 'nb',
-        'nl_NL' => 'nl', 'pl_PL' => 'pl', 'pt_PT' => 'pt',
-        'zh_CN' => 'zh_CN', 'zh_TW' => 'zh_TW', 'en_US' => 'en',
+        'de_DE' => 'de',
+//        'es_ES' => 'es',
+        'fr_FR' => 'fr',
+        'hr_HR' => 'hr',
+        'hu_HU' => 'hu',
+        'it_IT' => 'it',
+        'ja_JP' => 'ja',
+//        'nb_NO' => 'nb',
+        'nl_NL' => 'nl',
+//        'pl_PL' => 'pl',
+        'pt_PT' => 'pt',
+        'zh_CN' => 'zh_CN', 
+        'zh_TW' => 'zh_TW',
+        'en_US' => 'en',
         'C' => 'en'
         );
 

commit 66bd62b20050aa093f629fd444027da6b244da69
Author: Frank H. Ellenberger <frank.h.ellenberger at gmail.com>
Date:   Tue Sep 29 03:03:12 2020 +0200

    Improvement of metadata
    
    Fix quoting from previous commit,
    add og:locale*,
    allow title & description per page,
    and finally some cleanup.

diff --git a/externals/global_params.php b/externals/global_params.php
index 7fa0553..50e1e52 100644
--- a/externals/global_params.php
+++ b/externals/global_params.php
@@ -73,4 +73,7 @@
      $URL_FLATPAK="https://flatpak.org/";
      $URL_WIKI="https://wiki.gnucash.org/wiki/";
 
+     // some defaults for metatags in case the page does not set them
+     $default_title= T_ ( "Free Accounting Software" );
+     $default_description= T_("<span class=\"gnucash\">GnuCash</span> is personal and small-business financial-accounting software, freely licensed under the <a href=\"https://www.gnu.org/\">GNU</a> GPL and available for GNU/Linux, BSD, Solaris, Mac OS X and Microsoft Windows.");
      ?>
diff --git a/externals/header.phtml b/externals/header.phtml
index 3d5c252..ce1232b 100644
--- a/externals/header.phtml
+++ b/externals/header.phtml
@@ -5,7 +5,12 @@
   $titledonation = T_("Support the GnuCash project with a donation");
   $titleuservoice = T_("Request or vote enhancements for GnuCash");
   $titlefb = T_("GnuCash on facebook");
-  
+
+  include("$top_dir/externals/global_params.php");
+  if (!isset($title)) { $title = $GLOBALS["default_title"]; };
+  $full_title = $title." | GnuCash";
+  if (!isset($description)) { $description = $default_description; };
+
   # This function will create a link to the given page
   # reusing the get parameters that were specified
   # with the option to override the language
@@ -34,9 +39,10 @@
   }
 ?>
 
-<html lang="<?php echo $locale_str; ?>">
+<html prefix="og: https://ogp.me/ns#" lang="<?=$locale_str?>">
   <head>
-    <?php
+    <!-- Primary Meta Tags -->
+<?php
       if (!isset($can_utf)) { $can_utf = true; }
       if ($can_utf)
     { ?>
@@ -46,17 +52,25 @@
     <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes"/>
 
     <!--meta properties for facebook Open Graph-->
-    <meta property="og:title" content="<?=T_("Free Accounting Software")?> | GnuCash"/>
+    <meta property="og:locale" content="<?=$locale_str?>"/>
+<?php // add og:locale:alternate(s) 
+    foreach ($GLOBALS ["supported_languages"] as $key => $value) {
+      if ($value != $locale_str)
+      { echo "    <meta property=\"og:locale:alternate\" content=\"{$value}\"/>\n"; }
+    }
+    ?>
+    <meta property="og:title" content="<?=$full_title?>"/>
     <meta property="og:type" content="website"/>
     <meta property="og:url" content="https://www.gnucash.org/"/>
     <meta property="og:image" content="https://www.gnucash.org/externals/logo_w120.png"/>
     <meta property="og:site_name" content="GnuCash"/>
-    <meta property="og:description" content="<?=T_("<span class="gnucash">GnuCash</span> is personal and small-business financial-accounting software, freely licensed under the <a href="https://www.gnu.org/">GNU</a> GPL and available for GNU/Linux, BSD, Solaris, Mac OS X and Microsoft Windows.")?>"/>
+    <meta property="og:description" content="<?=strip_tags($description)?>"/>
     <!--end of Open Graph properties-->
 
-    <?php } ?>
+<?php } //if ($can_utf) ?>
     <link rel="stylesheet" href="<?=$home?>/externals/gnucash.css" type="text/css" />
 
+    <!-- FavIcons for many different devices -->
     <link rel="icon" href="<?=$home?>/favicon.ico" type="image/x-icon" />
     <link rel="apple-touch-icon" sizes="180x180" href="<?=$home?>/apple-touch-icon.png?v=gAXA7A9nAq"/>
     <link rel="icon" type="image/png" sizes="32x32" href="<?=$home?>/favicon-32x32.png?v=gAXA7A9nAq"/>
@@ -68,14 +82,13 @@
     <meta name="theme-color" content="#ffffff"/>
 
     <?php
-      include("$top_dir/externals/global_params.php");
       $current_page = array_key_exists('HTTP_HOST', $_SERVER) ? ($top_dir . "/" . basename($_SERVER["SCRIPT_NAME"])) : "";
       
       if (isset($homepage)) { ?>
         <link rel="alternate" type="application/atom+xml" title="Atom Feed" href="<?=$home?>/atom.php" />
     <?php } ?>
 
-    <title><?= T_($title); ?> | GnuCash</title>
+    <title><?=$full_title?></title>
   </head>
 
   <body>
@@ -141,7 +154,7 @@
         | <a class="nav" href="<?= make_lang_href($current_page, $get_parms, "hu_HU"); ?>">Magyar</a>
         | <a class="nav" href="<?= make_lang_href($current_page, $get_parms, "nl_NL"); ?>">Nederlands</a>
         <!--| <a class="nav" href="<?= make_lang_href($current_page, $get_parms, "nb_NO"); ?>">Norsk Bokmål</a>-->
-        <!-- | <a class="nav" href="<?= make_lang_href($current_page, $get_parms, "pl_PL"); ?>">Polska</a> -->
+        <!--| <a class="nav" href="<?= make_lang_href($current_page, $get_parms, "pl_PL"); ?>">Polska</a> -->
         | <a class="nav" href="<?= make_lang_href($current_page, $get_parms, "pt_PT"); ?>">Português</a>
         | <a class="nav" href="<?= make_lang_href($current_page, $get_parms, "zh_CN"); ?>">简体中文</a>
         | <a class="nav" href="<?= make_lang_href($current_page, $get_parms, "zh_TW"); ?>">繁體中文</a>
diff --git a/index.phtml b/index.phtml
index 71a347b..bb85157 100644
--- a/index.phtml
+++ b/index.phtml
@@ -2,7 +2,6 @@
 $homepage = true;
 include ("emulate_globals_on.php");
 include ("lang.php");
-$title = T_ ( "Free Accounting Software" );
 include ("externals/header.phtml");
 include ("externals/menu.phtml");
 ?>
@@ -46,7 +45,7 @@ include ("externals/menu.phtml");
       </div>
     </div>
 
-    <p class="justify"><?=T_("<span class=\"gnucash\">GnuCash</span> is personal and small-business financial-accounting software, freely licensed under the <a href=\"https://www.gnu.org/\">GNU</a> GPL and available for GNU/Linux, BSD, Solaris, Mac OS X and Microsoft Windows.")?></p>
+    <p class="justify"><?=$GLOBALS ["default_description"]?></p>
 
     <!-- FIXME: I18N spaces, markup-->
     <p class="justify"><?=T_("Designed to be easy to use, yet powerful and flexible, <span class=\"gnucash\">GnuCash</span> allows you to track bank accounts, stocks, income and expenses.  As quick and intuitive to use as a checkbook register, it is based on professional accounting principles to ensure balanced books and accurate reports. "); ?></p>

commit 062affde0e2297df973332a01bacd3541b69161a
Author: milotype <43657314+milotype at users.noreply.github.com>
Date:   Sun Mar 24 02:49:20 2019 +0100

    Update header.phtml
    
    To improve the multilinguality of the website in web-search results, I propose some changes in the meta tags of the <head> of the „header.phtml” file. The idea is to use translated text for the other languages.
    
    Changes would be made for:
    a) meta property="og:title"
    b) meta property="og:description"
    c) meta name="description"
    
    It has something to do with php stuff. As I’m not a programmer, I’m not sure if this solution works, nor if it is legit. But something similar is being used in the „menu.phtml” file.
    !!! Please see the diff between my new file and the orig file on master !!!
    
    P.S.
    I’ve checked my „experiment” at https://metatags.io/
    It seems that html-tags within then strings don’t matter (which I was afraid of).
    
    If my changes don’t work, maybe somebody knows how to handle the issue. But that would probably be something for a feature request ...

diff --git a/externals/header.phtml b/externals/header.phtml
index 75369ea..3d5c252 100644
--- a/externals/header.phtml
+++ b/externals/header.phtml
@@ -46,12 +46,12 @@
     <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes"/>
 
     <!--meta properties for facebook Open Graph-->
-    <meta property="og:title" content="Free Accounting Software | GnuCash"/>
+    <meta property="og:title" content="<?=T_("Free Accounting Software")?> | GnuCash"/>
     <meta property="og:type" content="website"/>
     <meta property="og:url" content="https://www.gnucash.org/"/>
     <meta property="og:image" content="https://www.gnucash.org/externals/logo_w120.png"/>
     <meta property="og:site_name" content="GnuCash"/>
-    <meta property="og:description" content="A personal and small-business financial-accounting software, licensed under GNU/GPL and available for Linux, Windows, Mac OS X, BSD, and Solaris."/>
+    <meta property="og:description" content="<?=T_("<span class="gnucash">GnuCash</span> is personal and small-business financial-accounting software, freely licensed under the <a href="https://www.gnu.org/">GNU</a> GPL and available for GNU/Linux, BSD, Solaris, Mac OS X and Microsoft Windows.")?>"/>
     <!--end of Open Graph properties-->
 
     <?php } ?>



Summary of changes:
 externals/global_params.php |  3 +++
 externals/header.phtml      | 31 ++++++++++++++++++++++---------
 index.phtml                 |  3 +--
 lang.php                    | 18 ++++++++++++++----
 4 files changed, 40 insertions(+), 15 deletions(-)



More information about the gnucash-changes mailing list