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

[Bug] Unparsable json in headers #1049

Closed
gilgongo opened this issue Sep 27, 2024 · 4 comments · Fixed by #1051
Closed

[Bug] Unparsable json in headers #1049

gilgongo opened this issue Sep 27, 2024 · 4 comments · Fixed by #1051
Labels
bug Something isn't working

Comments

@gilgongo
Copy link
Member

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 gilgongo added the bug Something isn't working label Sep 27, 2024
@pljones
Copy link
Contributor

pljones commented Sep 28, 2024

"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
Copy link
Contributor

pljones commented Sep 28, 2024

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 pljones linked a pull request Sep 28, 2024 that will close this issue
3 tasks
@pljones
Copy link
Contributor

pljones commented Sep 28, 2024

#1051 just might work.

@pljones
Copy link
Contributor

pljones commented Sep 28, 2024

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.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants