Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/izzygld/wp-graphql-google-schema
Integrating Google Schema within wp-graphql (jsonld)
https://github.com/izzygld/wp-graphql-google-schema
Last synced: about 1 month ago
JSON representation
Integrating Google Schema within wp-graphql (jsonld)
- Host: GitHub
- URL: https://github.com/izzygld/wp-graphql-google-schema
- Owner: izzygld
- Created: 2019-12-16T13:37:02.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-02-18T13:13:44.000Z (almost 5 years ago)
- Last Synced: 2024-08-02T05:15:19.511Z (4 months ago)
- Language: Vue
- Homepage: https://developers.google.com/search/docs/data-types/article
- Size: 243 KB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-wordpress-gatsby - WPGraphQL Google Schema - This FREE plugin from @izzygld261 adds Google Schema support to WPGraphQL. (Plugins / WordPress)
README
# wp-graphql-google-schema
Google Search works hard to understand the content of a page. You can help us by providing explicit clues about the meaning of a page to Google by including structured data on the page. Structured data is a standardized format for providing information about a page and classifying the page content; for example, on a recipe page, what are the ingredients, the cooking time and temperature, the calories, and so on.
Google uses structured data that it finds on the web to understand the content of the page, as well as to gather information about the web and the world in general.
As recommended by google - [Article](https://developers.google.com/search/docs/data-types/article)
## Pre-req's
Using this schema requires having the WPGraphQL plugin installed
and activated. (version 0.0.15 or newer)### Structure
* [Meta.php] - Regsitering and hooking up the Yoast SEO
* [article.vue] - Here's an example of JSON-LD code for an Article object.
* [audio.vue] - Here's an example of JSON-LD code for an Post format Audio object.
* [video.vue] - Here's an example of JSON-LD code for an Post format Audio object.
* [postQuery.ggl] - graphql query to reproduce the sample data.
* [exampleData] - data example.
### Todos
- Add more schema fields
- Add Date fields
- Add Language fields
- Add, Video, Audio, Recipes Schemas.
**Free Software, Hell Yeah!**
![Article Google Preview](https://res.cloudinary.com/orthodox-union/image/upload/f_auto,q_auto/v1576505886/OU/about/services/Screen_Shot_2019-12-16_at_16.15.40.png)
## Upcoming Releases
Using Google Tag Manager to Dynamically Generate Schema/JSON-LD Tags (Learn more)
Use Google Tag Manager to insert the code with the "Custom HTML" tag. (See screenshot below.) Why Tag Manager? Because Tag Manager can dynamically change the Structured Data based on the content of the page! (eg: Blog posts) See this article and this older Moz article for more information on how to do that.
UPDATE: Google changed something. Now, in order to have the Structured Data Testing tool detect inserted Structured Data properly, it must be inserted programatically. Pasting your desired Structured Data within this snippet below will allow it to be detected properly by the testing tool.
````html(function() {
var jsonData =// PASTE THE JSON THAT YOU WANT TO USE, HERE.
// Only paste what's within the <script> block.
// Your pasted content should start with a { and end with a }; var el = document.createElement('script');
el.type = 'application/ld+json';
el.innerHTML = JSON.stringify(jsonData);
document.head.appendChild(el);
})();````
See also: