A space to discuss online store customization, theme development, and Liquid templating.
We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more
Good night,
How should I parse to json a shop.name including an "&"? Right now, for a store titled "Test & Store", the code {{ shop.name | json }} returns something like "Test \u0026amp; Store".
This is causing problems with Google indexation.
One solution would be using "and" instead of "&", but I am afraid it could cause SEO problems. Another solution, is using the store name hardcoded instead of the code "shop.name | json", but if in the future there is change in the shop name, it will need to be searched and updated.
Any advice?
Thanks in advance,
For anyone else that lands here - I came across the same issue when parsing products titles for inclusion in a dataLayer for GTM. Got around it by replacing the parsed ampersand with just the html code;
{{ line_item.product.title | json | replace: "\u0026amp;", "\u0026" }}
So in your instance, maybe try:
{{ shop.name | json | replace: "\u0026amp;", "\u0026" }}