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

if JSONLD is array of objects, its metadata are not processed #908

Closed
jarofromel opened this issue Sep 11, 2024 · 0 comments · Fixed by #947
Closed

if JSONLD is array of objects, its metadata are not processed #908

jarofromel opened this issue Sep 11, 2024 · 0 comments · Fixed by #947
Labels
has-website-testcase metadata Issues with the metadata generated by readability reader-mode-has-issues

Comments

@jarofromel
Copy link

I noticed there are missing metadata (byline, to be specific) on the site irozhlas.cz. It is a newspaper page and it has JSONLD with metadata (see below). It is the array of objects.

I went through the tests sites and found that this "flavour" of JSONLD definition is not present. It seems to me the relevant part of code reabability.js do not match this flavour.

          var parsed = JSON.parse(content);
          if (
            !parsed["@context"] ||
            !parsed["@context"].match(/^https?\:\/\/schema\.org\/?$/)
          ) {
            return;
          }
<script type="application/ld+json">
[
  {
    "@context": "http://schema.org",
    "@type": "WebSite",
    "name": "iROZHLAS",
    "alternateName": "Zpravodajský server Českého rozhlasu",
    "url": "https://www.irozhlas.cz/"
  },
  {
    "@context": "http://schema.org",
    "@type": "BreadcrumbList",
    "itemListElement": [
      {
        "@type": "ListItem",
        "position": 1,
        "item": {
          "@id": "https://www.irozhlas.cz/veda-technologie",
          "name": "Věda a technologie"
        }
      },
      {
        "@type": "ListItem",
        "position": 2,
        "item": {
          "@id": "https://www.irozhlas.cz/veda-technologie/historie",
          "name": "Historie"
        }
      }
    ]
  },
  {
    "@context": "http://schema.org",
    "@type": "NewsArticle",
    "mainEntityOfPage": {
      "@type": "WebPage",
      "@id": "https://google.com/article"
    },
    "headline": "Plachetnice La Grace brázdí světová moře už 14 let. Kadeti se na ní učí starému námořnickému řemeslu",
    "description": "„Vycházeli jsme z plánů z roku 1768, které jsme našli v jednom námořním muzeu,“ vzpomíná Dvorský a dodává, že majitelem původní La Grace byl český korzár Augustin Heřman.",
    "datePublished": "2024-09-01T21:30:00",
    "dateModified": "2024-09-01T22:11:25",
    "author": [
      {
        "@type": "Person",
        "name": "Zdeněk Truhlář"
      }
    ],
    "publisher": {
      "@type": "Organization",
      "name": "iROZHLAS.cz",
      "logo": {
        "@type": "ImageObject",
        "url": "https://www.irozhlas.cz/sites/all/themes/custom/irozhlas/img/logo-schema-org.png",
        "width": 600,
        "height": 60
      }
    },
    "image": {
      "@type": "ImageObject",
      "url": "https://www.irozhlas.cz/sites/default/files/styles/zpravy_fotogalerie_large/public/images/fc969f99f99d229100a23d1fce7986a2.jpg?itok=o1UMwYsQ"
    }
  }
]
</script>
@cmkm cmkm added has-website-testcase reader-mode-has-issues metadata Issues with the metadata generated by readability labels Sep 19, 2024
gijsk pushed a commit that referenced this issue Jan 16, 2025
* Handle JSONLD arrays

* Fix prettier
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has-website-testcase metadata Issues with the metadata generated by readability reader-mode-has-issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants