fix schemaOrg warnings related to Articles during build
1. Change Summary
[Describe what is changing, why, and the impact]
- I noticed during our production builds that I had the following warnings
Unsupported schema type: undefined
During our builds, I noticed this was happening in chunks with a ton of blog articles- I looked at a few examples of schemas in the blog and saw that blog posts had their own schemas. If you go to a blog article that implements a schemaOrg, you get the error in the console: https://about.gitlab.com/blog/1k-contributors/
- The error is because the schema property is being sent as a string and not as an object - which is failing the schemaOrg type check
- Ideally, we should move towards having this in plain YAML
- I need to trim all of the spaces, remove trailing commas, to get JSON.parse() to work as expected
- I also made sure to add a case for a schema of type
article
and added docs around that when usingseo.schema
- I turned off schemaOrg reactivity, which is what was causing the global schemaOrg error on every page locally. We don't need to dynamically update the
schemaOrg
with reactivity changes, so we should leave this off
2. QA Checklist
[This merge request should follow all best practices utilizing our team code standards and our project's development documentation]
-
Code Cleanup: Any messages, linter warnings, and/or deprecation warnings are cleaned up in the console -
Tech Debt: I have created, or documented, any fast follow-up work that needs to be done after this MR is merged
[Provide concise steps to test the changes]
Review App
Production | Review app |
---|---|
https://about.gitlab.com/blog/1k-contributors/ | https://jg-try-to-remove-schemaorgbug.about.gitlab-review.app/blog/1k-contributors/ |
3. Review Steps
- Check for these warnings across the chunks in the build. You shouldn't see this anymore:
Unsupported schema type: undefined
- Look for blog articles that contain Article schemas, and make sure that they are being rendered correctly. I listed an example blog above:
Before | After |
---|---|
![]() |
![]() |
Edited by Javier Garcia