How to use double quotes when defining a variable?

Hi everyone,

I am trying to define a HTML code as a string in my footer.liquid

But because the string has double quotes " in it, it keeps returning an error.

The code should look something like this:

{% assign link = "<a href="https://www.google.de/"</a>" %

I tried double double quotes, but they do not work:

{% assign link = “<a href=”“https://www.google.de/”“” %} {{ link }}

Any ideas on this?

Kind regards

V4Y

In that situation, you should use single quotes with liquid, this will avoid a conflict. Also, your link is not valid html, but that’s something else. So in your example, it should actually look like this:

{% assign link = '[Click here](https://www.google.de/)' %}
{{ link }}

or you can also use capture tag, which is a different technic:

{%- capture link -%}
  [Click here](https://www.google.de/)
{%- endcapture -%}
{{ link }}

Let me know if that helps!

Hi @MaxDesign ,

it worked, thank you very much!