kumbi1 kumbi1 - 4 months ago 69
Twig Question

double-quotes making problems in google

I used the replace function in

to remove the unwanted pieces of the function and it is working perfectly except it still contains the double-quotes.
This is the code:

{% set htmlheader = sd_htmltitle(false) %}
{{ htmlheader|replace({'brand:': "", "websitesub:" : "", "websitecategory:" : "", '"' : ''}) }}

As you can see, I tried replacing the quotation marks, but they still appear in the title. Do you have a solution, or perhaps a better way to handle the situation if applicable? Everything else is getting removed properly.



You should add a \ before the quotation marks. So try this:

   {{ htmlheader|replace({'brand:': "", "websitesub:" : "", "websitecategory:" : "", '\"' : ''}) }}

Here a working example

Hope this help