simialbi / yii2-schema-org

Schema.org yii2 representation and helpers for json-ld generation
MIT License
17 stars 4 forks source link

Missing field "query-input" #10

Open ajoudeh-personal opened 1 year ago

ajoudeh-personal commented 1 year ago

Hi,

I use below code to generate WebSite schema

$siteLinks->potentialAction = new SearchAction(['target' => Yii::$app->urlManager->createAbsoluteUrl(['/site/search/', 'q' => '{search_term_string}']), 'query' => 'required name=search_term_string']);

i got this error from Google Search Test:

Missing field "query-input"

And '@context' => 'http://schema.org' need to be '@context' => 'https://schema.org'

Any Advice?

Thanks

simialbi commented 1 year ago

Hi @ajoudeh-personal

The @context I'll fix in the upcoming release. About the query-input: That seems to be some Google Thing, it's not documented in the specs (https://schema.org/Action). We may build something to dynamically add properties 🤔.

ajoudeh-personal commented 1 year ago

yes i see schema doc site, but when i fix it as workaround, its be valid in both site validation Google & Schema.

my work around is to pass potentialAction as json ["@type" => "SearchAction", 'target' => Yii::$app->urlManager->createAbsoluteUrl(['/site/search/']) . "?q={search_term_string}", 'query-input' => 'required name=search_term_string'];

Screenshot 2023-10-09 at 3 17 49 PM
simialbi commented 1 year ago

yeah but it's not even schema org property compliant (id-syntax instead of camelCase). Google 🤦🏻‍♂️... Maybe user DynamicModel as base to be able to add properties 🤔