URL Link Substitution using Variables

  • Updated

Sometimes Zingtree variables will be URLs, and you'll want to make them into links in emails or a content node. For example, a variable can be a URL of an uploaded image file or document, or a generated PDF file from a Document Node.

In tech-speak, you can set the ID or the class of an img or a href tag with the variable name, and it will replace the src= or href= part.

Examples

Assume we have a variable called my_url, which is the URL of a web page or document file.  The examples below are the HTML code to enter into your content node in code view. Switch the content node text editor to code view by clicking the </> icon.

Make a button that links to a document using a class (can have many uses of this link in the entire tree):

<a href="" class="btn btn-primary my_url">Get Document</a>


Make a button that links to a document using an ID (must have just one use of this link in the entire tree):

<a href="" id="my_url" class="btn btn-primary">Get Document</a>


Make a text link to a document:

<a href="" class="my_url">Link to document</a>


Replace an image:

<img src="" class="my_url">


Email nodes work differently. Here's how to generate a link in an email node:

<a href="#my_url#">Open Document</a>

 

Note that if you have multiple places where you want to substitute the URL, you should use class="my_url" instead of id="my_url".

 

Was this article helpful?

0 out of 1 found this helpful

Have more questions? Submit a request

Didn't find what you need?

Our friendly customer support team is here to help

Submit a Ticket

Looking for help or advice?

Reach out to our knowledgeable community of users.

Zingtree Community