jamuluswebsite icon indicating copy to clipboard operation
jamuluswebsite copied to clipboard

[Bug] Unparsable json in headers

Open gilgongo opened this issue 1 year ago • 4 comments

Probably a minor issue, but Google is complaining that https://jamulus.io/kb/2020/03/28/Server-Rpi.html and https://jamulus.io/it/kb/2022/08/04/Translating-po-files.html have "Error parsing an array value: missing a comma or closing bracket in an array declaration."

  {
    "@context":"https://schema.org",
    "@type":"BlogPosting",
    "headline": "Install Jamulus Server on a Raspberry Pi",
    
    
    "publisher": {
      "@type": "Person",
      "name": "fredsiva",
      
    }, <--- highlights this as the error location
    "author": {
      "@type": "Person",
      "name": "fredsiva",
      
    },

Looking at _layouts/post.html I'm not sure how to fix it though - does it need re-generating in some way?

gilgongo avatar Sep 27 '24 14:09 gilgongo

"name": {
  "key": "value",
}

has a trailing comma after "value", which will confuse most parsers. The template should be written to only add a comma before the second and subsequent entry, rather than after every entry. (Some templating schemas have explicit support for this need.)

pljones avatar Sep 28 '24 10:09 pljones

Or for this kind of if block:

    "publisher": {
      "@type": "Person",
      "name": "{% if site.data.authors[page.author].name %}{{ site.data.authors[page.author].name }}{% else %}{{ page.author }}{% endif %}",
      {% if site.data.authors[page.author].url %}"url": "{{ site.data.authors[page.author].url }}"{% endif %}
    },

do this:

    "publisher": {
      "@type": "Person",
      "name": "{% if site.data.authors[page.author].name %}{{ site.data.authors[page.author].name }}{% else %}{{ page.author }}{% endif %}"{% if site.data.authors[page.author].url %},
      "url": "{{ site.data.authors[page.author].url }}"{% endif %}
    },

so that the {% if starts before the , that separates the conditional element from the previous content.

pljones avatar Sep 28 '24 16:09 pljones

https://github.com/jamulussoftware/jamuluswebsite/pull/1051 just might work.

pljones avatar Sep 28 '24 17:09 pljones

I get this:

  {
    "@context":"https://schema.org",
    "@type":"BlogPosting",
    "headline": "Install Jamulus Server on a Raspberry Pi",
    "publisher": {
      "@type": "Person",
      "name": "fredsiva"
    },
    "author": {
      "@type": "Person",
      "name": "fredsiva"
    },
    "datePublished": "2020-03-28T00:00:00-05:00"
  }

http://jamuluswebsite.drealm.info/kb/2020/03/28/Server-Rpi.html

(I might contend - and I might have said before - that "publisher" should be "Jamulus Development Team", or some other representation of the jamulus.io site owners.)

pljones avatar Sep 28 '24 17:09 pljones