Browse Source

manual: improved HTML page headers (#946)

SEO: ideally improves search engine ranking of the manual pages
Markus Neteler 4 years ago
parent
commit
a7a7817670
4 changed files with 28 additions and 14 deletions
  1. 1 1
      lib/gis/parser.c
  2. 16 4
      lib/gis/parser_html.c
  3. 2 2
      man/build_html.py
  4. 9 7
      tools/mkhtml.py

+ 1 - 1
lib/gis/parser.c

@@ -899,7 +899,7 @@ int G__uses_new_gisprompt(void)
 /*!
   \brief Print list of keywords (internal use only)
 
-  If <em>format</em> function is NULL than list of keywords is printed
+  If <em>format</em> function is NULL then list of keywords is printed
   comma-separated.
 
   \param[out] fd file where to print

+ 16 - 4
lib/gis/parser_html.c

@@ -3,7 +3,7 @@
   
   \brief GIS Library - Argument parsing functions (HTML output)
   
-  (C) 2001-2009, 2011-2013 by the GRASS Development Team
+  (C) 2001-2009, 2011-2020 by the GRASS Development Team
   
   This program is free software under the GNU General Public License
   (>=v2). Read the file COPYING that comes with GRASS for details.
@@ -43,11 +43,23 @@ void G__usage_html(void)
     fprintf(stdout,
 	    "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n");
     fprintf(stdout, "<html>\n<head>\n");
-    fprintf(stdout, "<title>%s - GRASS GIS manual</title>\n", st->pgm_name);
     fprintf(stdout,
-	    "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\n");
+	    " <meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\n");
+    fprintf(stdout, " <title>%s - GRASS GIS manual</title>\n", st->pgm_name);
+    fprintf(stdout, " <meta name=\"description\" content=\"%s", st->pgm_name);
+    if (st->module_info.description)
+        fprintf(stdout, ": %s\">", st->module_info.description);
+    else
+        fprintf(stderr,"<%s.html> is missing the description", st->pgm_name);
+    fprintf(stdout, "\n");
+    if (st->module_info.keywords) {
+        fprintf(stdout, " <meta name=\"keywords\" content=\"");
+        G__print_keywords(stdout, NULL);
+        fprintf(stdout, "\">");
+	fprintf(stdout, "\n");
+    }
     fprintf(stdout,
-	    "<link rel=\"stylesheet\" href=\"grassdocs.css\" type=\"text/css\">\n");
+	    " <link rel=\"stylesheet\" href=\"grassdocs.css\" type=\"text/css\">\n");
     fprintf(stdout, "</head>\n");
     fprintf(stdout, "<body bgcolor=\"white\">\n");
     fprintf(stdout, "<div id=\"container\">\n\n");

+ 2 - 2
man/build_html.py

@@ -2,7 +2,7 @@
 # -*- coding: utf-8 -*-
 
 # utilities for generating HTML indices
-# (c) 2003-2019 by the GRASS Development Team, Markus Neteler, Glynn Clements, Luca Delucchi
+# (c) 2003-2020 by the GRASS Development Team, Markus Neteler, Glynn Clements, Luca Delucchi
 
 import sys
 import os
@@ -33,8 +33,8 @@ header1_tmpl = string.Template(\
 r"""<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
 <html>
 <head>
- <title>${title}</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <title>${title} - GRASS GIS Manual</title>
  <meta name="Author" content="GRASS Development Team">
 """)
 

+ 9 - 7
tools/mkhtml.py

@@ -7,7 +7,7 @@
 #               Glynn Clements
 #               Martin Landa <landa.martin gmail.com>
 # PURPOSE:      Create HTML manual page snippets
-# COPYRIGHT:    (C) 2007-2017 by Glynn Clements
+# COPYRIGHT:    (C) 2007-2020 by Glynn Clements
 #                and the GRASS Development Team
 #
 #               This program is free software under the GNU General
@@ -78,9 +78,11 @@ addons_url = "https://github.com/OSGeo/grass-addons/tree/master/"
 header_base = """<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <html>
 <head>
-<title>GRASS GIS Manual: ${PGM}</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link rel="stylesheet" href="grassdocs.css" type="text/css">
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <title>${PGM} - GRASS GIS Manual</title>
+ <meta name="Author" content="GRASS Development Team">
+ <meta name="description" content="${PGM}: ${PGM_DESC}">
+ <link rel="stylesheet" href="grassdocs.css" type="text/css">
 </head>
 <body bgcolor="white">
 <div id="container">
@@ -118,7 +120,7 @@ footer_index = string.Template(
 </p>
 <p>
 &copy; 2003-${YEAR}
-<a href="http://grass.osgeo.org">GRASS Development Team</a>,
+<a href="https://grass.osgeo.org">GRASS Development Team</a>,
 GRASS GIS ${GRASS_VERSION} Reference Manual
 </p>
 
@@ -138,7 +140,7 @@ footer_noindex = string.Template(
 </p>
 <p>
 &copy; 2003-${YEAR}
-<a href="http://grass.osgeo.org">GRASS Development Team</a>,
+<a href="https://grass.osgeo.org">GRASS Development Team</a>,
 GRASS GIS ${GRASS_VERSION} Reference Manual
 </p>
 
@@ -265,7 +267,7 @@ def update_toc(data):
 # process header
 src_data = read_file(src_file)
 name = re.search('(<!-- meta page name:)(.*)(-->)', src_data, re.IGNORECASE)
-pgm_desc = None
+pgm_desc = "GRASS GIS Reference Manual"
 if name:
     pgm = name.group(2).strip().split('-', 1)[0].strip()
     name_desc = re.search('(<!-- meta page name description:)(.*)(-->)', src_data, re.IGNORECASE)