Google Structured Data

  • You cannot paste it with the tags, they are included automaticly.

    The LORD is my strength and my shield; in him my heart trusts, and I am helped; my heart exults, and with my song I give thanks to him. Psalm 28,7

  • yes but the tags are required by the google bot, so there is no chance to use your extension in this case :)

    its doesnt matter if inline or as file, google just doesnt recognize it, it needs the full code with tags in the given order


    are you using structured data ? please give it a try by yourself then you will see,


    btw this topic shhould be moved to seo, right ?

  • Generally you can add scripts like this:

    $view->scripts('name','path/to/script, ['defer' => true, (...) ])

    You can define as many options you would like. The problem is, that only two are relevant when the tags are rendered:

    You just would have to add some line of codes and it would be possible. But the problem is, that you cannot overwrite this render as it is triggered:

    PHP: pagekit/app/modules/view/src/Helper/ScriptHelper.php
    1. /**
    2. * {@inheritdoc}
    3. */
    4. public function register(View $view)
    5. {
    6. $view->on('head', function ($event) use ($view) {
    7. $view->trigger('scripts', [$this->scripts]);
    8. $event->addResult($this->render());
    9. }, 5);
    10. }

    Dirty way would be to listen to scripts, do $event->addResult(customRenderFunction()), then delete every assets from the scriptmanager, so the original, following $event->addResult($this->render()) will get nothing. Just a guess how I would try to solve that :D.


    P.S You should be able to acces the scriptmanager via App::scripts() or $app['scripts'].

    The LORD is my strength and my shield; in him my heart trusts, and I am helped; my heart exults, and with my song I give thanks to him. Psalm 28,7