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

FAQJsonLD erroring #18

Closed
shanejones opened this issue May 20, 2020 · 7 comments · Fixed by #19
Closed

FAQJsonLD erroring #18

shanejones opened this issue May 20, 2020 · 7 comments · Fixed by #19

Comments

@shanejones
Copy link
Contributor

Just noticed what appears to be an error with FAQ Schema

To double-check it wasn't my markup I used your example code from within the repo

In my imports I have

import { GatsbySeo, ArticleJsonLd, FAQJsonLd } from "gatsby-plugin-next-seo";

And in the main component block, I have

    <FAQJsonLd
      mainEntity={[
        { question: "What?", answer: "Stand" },
        { question: "How?", answer: "Effort" },
        { question: "Why?", answer: "Peace" },
      ]}
    />

The error I'm getting is TypeError: can't access property "map", questions is undefined

I have this in a component that also uses ArticleJsonLd and that is outputting fine on the page.

@ifiokjr
Copy link
Owner

ifiokjr commented May 24, 2020

Would you be comfortable creating a PR with a fix for this?

@shanejones
Copy link
Contributor Author

Will have a dig around today. Not familiar with Gatsby plugins but this might be a good first contribution. 😁

@shanejones
Copy link
Contributor Author

Right I've had a look and I've worked it out to be an issue with this block in faq.js

  var mainEntity = _ref2.questions,
      _ref2$overrides = _ref2.overrides,
      overrides = _ref2$overrides === void 0 ? {} : _ref2$overrides,
      _ref2$defer = _ref2.defer,
      defer = _ref2$defer === void 0 ? false : _ref2$defer;

When I console log _ref2 it outputs the questions and answers, when I console.log mainEntity it returns undefined.

I'm unsure what this block does and also unsure how to tweak this plugin as it appears to be in TypeScript.

@ifiokjr
Copy link
Owner

ifiokjr commented May 26, 2020

Thanks for looking into it. I'll make some time to provide a fix. This week is already full of deadlines, so maybe next week at the earliest.

@jayjayzheng
Copy link

change "mainEntity" to "questions" should just work

@shanejones
Copy link
Contributor Author

Documentation PR submitted.

@ifiokjr ifiokjr linked a pull request Jun 15, 2020 that will close this issue
@ifiokjr
Copy link
Owner

ifiokjr commented Jun 15, 2020

Thanks @jayjayzheng and @shanejones! 😄

@ifiokjr ifiokjr closed this as completed Jun 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants