Giter Site home page Giter Site logo

thedigitaloctopus / wp-graphql-google-schema Goto Github PK

View Code? Open in Web Editor NEW

This project forked from izzygld/wp-graphql-google-schema

0.0 1.0 0.0 249 KB

Integrating Google Schema within wp-graphql (jsonld)

Home Page: https://developers.google.com/search/docs/data-types/article

PHP 45.36% Vue 54.64%

wp-graphql-google-schema's Introduction

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

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

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.

<!-- GOOGLE TAG MANAGER VERSION -->
<!-- Credit: https://twitter.com/SimoAhava/status/1001397355403468802 -->
<!-- Source: https://github.com/JayHoltslander/Structured-Data-JSON-LD -->
<script>
(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);
})();
</script>

See also:


wp-graphql-google-schema's People

Contributors

izzygld avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.