query-input google and scheme.org | WordPress.org

[ad_1]

Google’s markup schema differs from the schema.org standard.
From the standard page: schema.org https://schema.org/SearchAction an example is shown like this:

“SearchAction”,
“target”: “http://example.com/search?&q={query}”,
“query”: “required”

But if you check this example in: Google Rich Scheme Test
that will give an error! For Google to accept it, you need a different format:

“SearchAction”,
“target”: “https://query.example.com/search?q={search_term_string}”,
“query-input”: “required name=search_term_string”

Yandex follows the standard from https://schema.org/SearchAction
And Google has its own vision of this standard!

You are using the google standard in aioseo, not the scheme.org standard
This is what your code looks like in graphs/WebSite.php

‘urlTemplate’ => $homeUrl . ‘?s={search_term_string}’
],
‘query-input’ => ‘required name=search_term_string’,
];

I change it to my code using 2 types. It passes validation both in Google and on scheme.org

‘urlTemplate’ => $homeUrl . ‘search?&q={query}’
], ‘query’ => ‘required’,
‘query-input’ => ‘required name=query’,
];

The problem is that when the plugin is updated, the code crashes. You can initially target both google and scheme.org, as I gave the example above. Or write a hook for those who want to use this solution.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer