From 2abc850c33693b607169b798110b0ad12981654d Mon Sep 17 00:00:00 2001 From: Tom Schraitle Date: Mon, 29 Jan 2024 13:50:06 +0100 Subject: [PATCH] Fix DOCTEAM-1249: Create external JSON-LD file The structure is based on schema.org Introduce new parameters: * generate.json-ld.external (0=no, 1=yes) Should a JSON-LD structure stored? * json-ld-use-individual-authors (0=no, 1=yes) Should the individual authors be used? * json-ld.ext (default ".json) The default extension of the JSON file * json-ld-date-timezone (default "T00:00+02:00) The default timezone for dates when no timezone is specified * json-ld-fallback-author-name (default "SUSE Product & Solution Documentation Team") Default name of author when no is specified * json-ld-fallback-author-url (default: "https://documentation.suse.com") Default URL for an author, when no is specified * json-ld-fallback-author-type (default "Corporation") Default type of an author, when no is specified * json-ld-fallback-author-logo (default "https://www.suse.com/assets/img/suse-white-logo-green.svg") Default logo URL, when no is specified * json-ld-image-url (default $json-ld-fallback-author-logo) Default image URL for a TechArticle * stitchfile (str, default ='') Absolute filename to the single stitch file that Docserv generates on startup --- suse2022-ns/xhtml/docbook.xsl | 33 ++ suse2022-ns/xhtml/json-ld.xsl | 714 +++++++++++++++++++++++++++------- suse2022-ns/xhtml/param.xsl | 19 +- 3 files changed, 621 insertions(+), 145 deletions(-) diff --git a/suse2022-ns/xhtml/docbook.xsl b/suse2022-ns/xhtml/docbook.xsl index b0986865..559f4307 100644 --- a/suse2022-ns/xhtml/docbook.xsl +++ b/suse2022-ns/xhtml/docbook.xsl @@ -699,6 +699,39 @@ + + + + + + + + + + + + + + WARN + + JSON-LD + + + The parameter $dcfile is unset. Cannot find the DC file in Docserv config. + + + + + + + + + + + + + + diff --git a/suse2022-ns/xhtml/json-ld.xsl b/suse2022-ns/xhtml/json-ld.xsl index c774891b..33def1dd 100644 --- a/suse2022-ns/xhtml/json-ld.xsl +++ b/suse2022-ns/xhtml/json-ld.xsl @@ -7,26 +7,63 @@ * $generate.json-ld (default 1): generate the structure (=1) or not (=0) Output: - HTML - Authors: Thomas Schraitle , + HINT 1 + To create a JSON-LD structure for the HTML file, use generate.json-ld=1 + If you need an additional external JSON-LD file, use: + * generate.json-ld=1 + * generate.json-ld.external=1 + * stitchfile="/tmp/docserv-stitch-....xml" + * dcfilename="DC-..." + + HINT 2 + Validate the output with: + * https://validator.schema.org + * https://search.google.com/test/rich-results + + Authors: Thomas Schraitle , 2023-2024 --> + + + + + +]> - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + WARN: Cannot convert string ''. Not a valid date! + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text + + + + + + + + + - - INFO: Going to generate JSON-LD... - + + + + + + + "additionalType": "", + + + - + "headline": "", + + + + + + + + + + + + + + + + + "inLanguage": "", + + + @@ -127,16 +415,21 @@ - + + - - "keywords": [ - - - , - - ], - + + + + "keywords": [ + + + , + + ], + + + @@ -148,8 +441,12 @@ --> - + + + author - - - - - - + + + + + + + + + + + + + + - - - + - - INFO: found one author - - - - - - "author": { - "@type": "Person", - "name": "" - }, - - - "author": [ - - + + + "author": [ + { + "@type": "", + "name": "", + "url": "" + } ], - - - - - - - - - "author": { - "@type": "", - "name": "", - "url": "", - - "logo": "" - }, - - - - - - - - "version": "", - - - - - - - - - - - - - - - + + "": [ + + + + + + + + + + + + + + Corporation + Person + + + { - "@type": "Person", - "name": "" - }, - - - - - - + "@type": "", + "name": "", + "url": "" + + , + "affiliation": { + "@type": "Corporation", + "name": "" + } + + + }, + + ], + + - + + + + - - - - + + + + + + + + @@ -315,16 +599,23 @@ + + + + + + + Y-m-d + + + + + - - - - - Y-m-d + + - - @@ -361,4 +652,141 @@ } + + + + + + + + "articleSection": [ + "" + , + + ], + + + + + + + + "affiliatedOrganization": [ + { + "@type": "Organization", + "name": "" + }, + + ], + + + + + + + + + + "isPartOf": { + "@type": "CreativeWorkSeries", + "name": "" + }, + + + + + + + + + + + + + + + + + + + SUSE-SLES + SUSE-SLED + SLE-Micro + + + + + + + + + + + + + "releaseNotes": "", + + + + + + + + "about": [{ + "@type": "Thing", + "name": "" + }, + + ], + + + + + + + + + + + + + + + + + + + + , + + + + + "mentions": [ + + { "@type": "SoftwareApplication", + "name": "", + "softwareVersion": "", + "applicationCategory": "Operating System", + "operatingSystem": "Linux", + "processorRequirements": "" + + } + , + + ], + + \ No newline at end of file diff --git a/suse2022-ns/xhtml/param.xsl b/suse2022-ns/xhtml/param.xsl index ed3292e1..073288b1 100644 --- a/suse2022-ns/xhtml/param.xsl +++ b/suse2022-ns/xhtml/param.xsl @@ -461,13 +461,28 @@ task before + + + + - SUSE documentation team + + .json + + T00:00+02:00 + SUSE Product & Solution Documentation Team https://documentation.suse.com Corporation - https://www.suse.com/assets/img/suse-white-logo-green.svg + https://www.suse.com/assets/img/suse-white-logo-green.svg + + + + {{#language#}}