Skip to content

Commit

Permalink
SEO and manuals: add viewport and page language (#2591)
Browse files Browse the repository at this point in the history
This PR addresses #2589 (SEO problems on mobile devices):
- Google: addresses "Page isn't usable on mobile" - "Viewport not set"
    - https://search.google.com/search-console/mobile-usability?resource_id=http%3A%2F%2Fgrass.osgeo.org%2F&hl=en
    - see: https://support.google.com/webmasters/answer/9063469#viewport_not_configured
- Bing: addresses "The page is missing meta language information"
    - https://www.bing.com/webmasters/seoreports?siteUrl=https%3A%2F%2Fgrass.osgeo.org%2F&ruleId=39

Manual pages generated with this PR applied are validated correctly at https://validator.w3.org/
  • Loading branch information
neteler committed Oct 3, 2022
1 parent 13cdec4 commit 225a4f8
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 31 deletions.
2 changes: 2 additions & 0 deletions REQUIREMENTS.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>REQUIREMENTS to compile GRASS GIS 7</title>
<link rel="stylesheet" href="grassdocs.css" type="text/css">
<meta http-equiv="content-language" content="en-us">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body bgcolor="#FFFFFF">

Expand Down
6 changes: 4 additions & 2 deletions db/drivers/mysql/grass-mesql.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
<html>
<head>
<title>GRASS-MySQL embedded driver - GRASS GIS manual</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">
<link rel="stylesheet" href="grassdocs.css" type="text/css">
<meta http-equiv="content-language" content="en-us">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body bgcolor="white">

Expand Down
6 changes: 4 additions & 2 deletions general/g.setproj/g.setproj.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
<html>
<head>
<title>g.setproj - GRASS GIS manual</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">
<link rel="stylesheet" href="grassdocs.css" type="text/css">
<meta http-equiv="content-language" content="en-us">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body bgcolor="white">

Expand Down
45 changes: 32 additions & 13 deletions lib/gis/parser_html.c
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@

/*!
\file lib/gis/parser_html.c
\brief GIS Library - Argument parsing functions (HTML output)
(C) 2001-2009, 2011-2013 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.
\author Original author CERL
*/
\file lib/gis/parser_html.c
\brief GIS Library - Argument parsing functions (HTML output)
(C) 2001-2022 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.
\author Original author CERL
*/

#include <stdio.h>
#include <string.h>
Expand Down Expand Up @@ -45,9 +46,27 @@ void G__usage_html(void)
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,
" <meta name=\"Author\" content=\"GRASS Development Team\">\n");
fprintf(stdout,
" <meta http-equiv=\"content-language\" content=\"en-us\">\n");
fprintf(stdout,
" <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n");
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");
Expand Down
17 changes: 11 additions & 6 deletions man/build_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@
"r.watershed.ram",
"r.watershed.seg",
"v.topo.check",
"helptext.html"]
"helptext.html",
]

# these modules don't use G_parser()

desc_override = {
"g.parser": "Provides automated parser, GUI, and help support for GRASS scipts.",
"r.li.daemon": "Support module for r.li landscape index calculations."
}
}

############################################################################

Expand All @@ -36,14 +37,18 @@
<title>${title}</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Author" content="GRASS Development Team">
""")
<meta http-equiv="content-language" content="en-us">
<meta name="viewport" content="width=device-width, initial-scale=1">
"""
)

macosx_tmpl = string.Template(\
r"""
<meta name="AppleTitle" content="GRASS GIS ${grass_version} Help">
<meta name="AppleIcon" content="GRASS-${grass_mmver}/grass_icon.png">
<meta name="robots" content="anchors">
""")
"""
)

header2_tmpl = string.Template(\
r""" <link rel="stylesheet" href="grassdocs.css" type="text/css">
Expand Down Expand Up @@ -314,7 +319,7 @@

headertopics_tmpl = \
r"""
<link rel="stylesheet" href="grassdocs.css" type="text/css">
<link rel="stylesheet" href="grassdocs.css" type="text/css">
</head>
<body style="width: 99%">
<div id="container">
Expand All @@ -328,7 +333,7 @@

headerkeywords_tmpl = \
r"""
<link rel="stylesheet" href="grassdocs.css" type="text/css">
<link rel="stylesheet" href="grassdocs.css" type="text/css">
</head>
<body style="width: 99%">
<div id="container">
Expand Down
6 changes: 4 additions & 2 deletions raster/r.li/r.li.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
<html>
<head>
<title>r.li - GRASS GIS manual</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">
<link rel="stylesheet" href="grassdocs.css" type="text/css">
<meta http-equiv="content-language" content="en-us">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body bgcolor="white">
<div id="container">
Expand Down
10 changes: 7 additions & 3 deletions tools/mkhtml.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,13 @@ def get_last_git_commit(src_dir, is_addon, addon_path):
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">
<title>GRASS GIS Manual: ${PGM}</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Author" content="GRASS Development Team">
<meta name="description" content="${PGM}: ${PGM_DESC}">
<link rel="stylesheet" href="grassdocs.css" type="text/css">
<meta http-equiv="content-language" content="en-us">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body bgcolor="white">
<div id="container">
Expand Down
8 changes: 5 additions & 3 deletions tools/module_synopsis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,11 @@ cat << EOF > "${TMP}.html"
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>`g.version | cut -f1 -d'('` Command list</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="grassdocs.css" type="text/css">
<title>`g.version | cut -f1 -d'('` Command list</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-language" content="en-us">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body bgcolor="white">
Expand Down

0 comments on commit 225a4f8

Please sign in to comment.