From 229aff8315ed680524102273fd1106306339b38f Mon Sep 17 00:00:00 2001 From: Francois Prunayre Date: Mon, 15 May 2023 12:14:57 +0200 Subject: [PATCH] SEO / Set HTML head title and description Currently HTML head description is set to an empty value. Google is indexing the cookie warning in GeoNetwork case when no HTML head is found (probably because it is the first HTML text content found). Use the service metadata configured for the main node (see admin > settings > record to use for GetCapabilities) and same for portal. If no service metadata record configured, default title and description to node name (or site name for the main portal). Follow up of: * https://github.com/geonetwork/core-geonetwork/commit/611be2a0f5a514be9fa3b80a14b0dd785c94dba9 * https://github.com/geonetwork/core-geonetwork/pull/4758 --- .../java/org/fao/geonet/util/XslUtil.java | 11 ++++++ web/src/main/webapp/xslt/base-layout.xsl | 34 ++++++++++++++++--- 2 files changed, 41 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/org/fao/geonet/util/XslUtil.java b/core/src/main/java/org/fao/geonet/util/XslUtil.java index 1577c30d369..3b6c3ae5906 100644 --- a/core/src/main/java/org/fao/geonet/util/XslUtil.java +++ b/core/src/main/java/org/fao/geonet/util/XslUtil.java @@ -459,6 +459,17 @@ public static String getNodeLogo(String key) { return source.isPresent() ? source.get().getLogo() : ""; } + public static String getDiscoveryServiceUuid(String key) { + Optional source = getSource(key); + if (source.isPresent() && source.get().getType() == SourceType.subportal) { + return source.get().getServiceRecord(); + } else { + SettingManager settingsMan = ApplicationContextHolder.get().getBean(SettingManager.class); + String uuid = settingsMan.getValue(SYSTEM_CSW_CAPABILITY_RECORD_UUID); + return "-1".equals(uuid) ? "" : uuid; + } + } + private static Optional getSource(String idOrUuid) { SettingManager settingsMan = ApplicationContextHolder.get().getBean(SettingManager.class); if (StringUtils.isEmpty(idOrUuid)) { diff --git a/web/src/main/webapp/xslt/base-layout.xsl b/web/src/main/webapp/xslt/base-layout.xsl index fe65b0040d6..4cf29584171 100644 --- a/web/src/main/webapp/xslt/base-layout.xsl +++ b/web/src/main/webapp/xslt/base-layout.xsl @@ -41,14 +41,40 @@ - - <xsl:value-of select="util:getNodeName('', $lang, true())"/> - + + + + + + + + + <xsl:value-of select="$htmlHeadTitle"/> - +