Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement JSON-LD #552

Merged
merged 1 commit into from
Jul 26, 2023
Merged

Implement JSON-LD #552

merged 1 commit into from
Jul 26, 2023

Conversation

tomschr
Copy link
Collaborator

@tomschr tomschr commented Jul 24, 2023

After Jana did some research, it seems that JSON-LD (JSON Linked Data) is the way to go for our metadata.

This PR fixes DOCTEAM-1061 and contains the following changes:

  • By default, JSON-LD is not generated.
  • Add the <script type="application/ld+json">...</script in the <head> tag.
  • Add the JSON-LD content inside the previous <script>:
    • "@context": "http://schema.org",: constant

    • "@type": "TechArticle",: constant

    • "headline": using the info/title or title tag whatever is available

    • "abstract": using the first info/abstract or info/highlights tag whatever is available

    • "author": using info/authorgroup. Creates a list of authors like:

      "author": [
         {"@type": "Person", "name": "Tux Penguin", "role": "Writer"},
         {"@type": "Person", "name": "Wilber Gimp", "role": "Editor"}
      ]

      If no authorgroup is available, the "author" entry is skipped.

    • "dateModified": adding the current date using the extension function date:date-time()

    • "datePublished": using info/meta[@name='published'] (just a placeholder), info/pubdate, info/date, or info/revhistory/revision[1]/date in this order. If none of these elements are available, no entry is created. (Needs to be discussed)

    • "publisher": a constant, created as:

      "publisher": {
        "@type": "Organization",
        "name": "SUSE",
        "logo": {
          "@type": "ImageObject",
          "url": "https://www.suse.com/assets/img/suse-white-logo-green.svg"
        }
      }

Other, useful properties

  • datePublished, dateModified, dateCreated: dates about our document. Not entirely sure which could be helpful
  • articleSection: could be a sub structure that belongs to a higher parent structure (like a chapter in a book). This would probably only be useful for chunked HTML (if at all)
  • audience: our intended audience (beginners, developers, experts, ...)
  • archivedAt, expires: when one of our guides goes end of life.
  • copyrightHolder, copyrightNotice, copyrightYear: maybe useful for legal reasons
  • license: could point to the URL of GNU FDL (or any other licenses)
  • creativeWorkStatus: its stage in a lifecycle, for example Incomplete, Draft, Published, Obsolete. Could be helpful when something is in "beta state" (like ALP).
  • genre: could that hold our categories (like "systems management")?
  • inLanguage: the language that the text is written in
  • keywords: could be used to describe the article. Multiple entries in a keywords list are possible
  • version: could hold the release (15 SP5, for example). For doc-modular or doc-unversioned, this key can be skipped.
  • proficiencyLevel: Proficiency needed for this content, expected values: 'Beginner', 'Expert'.

References

@tomschr tomschr requested a review from GGayathri3 July 24, 2023 16:25
@tomschr tomschr force-pushed the docteam-1061-json-ld branch 4 times, most recently from 244718d to c593165 Compare July 26, 2023 14:48
Fixes DOCTEAM-1061

Introduces a new parameter:

* generate.json-ld: Switch to generate (=1) or not (=0).
  By default, it's currently disabled

Currently the following Schema.org properties are created:

* "headline": using the first info/title or title tag
* "abstract": using the first info/abstract or info/highlights tag
* "author": using info/authorgroup or info/author (multiple)
* "dateModified": create current date using the extension function
  "date:date-time()"
* "datePublished": using info/meta[@name='published'] (placeholder),
  info/pubdate, info/date or info/revhistory/revision[1]/date in this
  order
* "version": using info/productnumber
* "keywords": using info/keywords
* "publisher": a reference to SUSE and its logo
@tomschr tomschr marked this pull request as ready for review July 26, 2023 14:51
@tomschr tomschr merged commit 9f1bdee into main Jul 26, 2023
2 checks passed
@tomschr tomschr deleted the docteam-1061-json-ld branch July 26, 2023 14:54
@tomschr
Copy link
Collaborator Author

tomschr commented Jul 26, 2023

The fine-tuning part is done next week. However, for testing purposes, it's probably fine enough.

@tomschr tomschr added the topic-seo All about search engine optimization label Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic-seo All about search engine optimization
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant