-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Figure out a way to render block in head #1
Comments
Maybe using another event related to the product show page would be a better idea and then adding a block extending the metatags block into the twig file linked to this event. Here is the template : https://github.com/Sylius/Sylius/blob/master/src/Sylius/Bundle/ShopBundle/Resources/views/Product/show.html.twig
|
@Prometee That is an excellent idea. There is already a metatags block in the default layout template, if we can extend this block it can be rendered in the head directly without the Javascript functions! I'm going to give it a try 😏 |
@Prometee Only issue i'm guessing is that you cant just extend blocks in a sonata block event. I've done a quick test on a clean project and it wont let me render blocks in an event template. If i include the |
@Prometee Feel free to give it a try! If it works, just open a PR and i’ll check it out 😉 |
@JoppeDC So I think the only way is to make a twig extension, it will allow use to make everything we want... I'm trying to understand how it could be done right I will made a PR if I found a way. |
I've been looking at the Setono's Tag Bag Plugin / Sylius Analytics Plugin, they put their library tags in the head thru event suscribers probably some good inspiration there. |
@tuala thanks for the heads up! I’ll definetly give it a look 😉 |
Currently we're using javascript to create meta tags in the header, from the body.
The cleanest way would be if we could render the
_seo_block
directly in the header itself.This can be done using the sonata block render event
sylius.shop.layout.head
. The problem is that we can't access the product in this context._seo_block
render to headThe text was updated successfully, but these errors were encountered: