Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Can not append liquid variable with page.url variable

Can not append liquid variable with page.url variable

Lindanarm
Shopify Partner
6 1 0

Hi, I am trying to implement a linking which makes use of the liquid 'page.url' variable.

The 'page.url' should be appended to the end of an external url. The linking works, but it opens only the url "https://localhost:3000/help?backTo=" without the 'page.url' appended to it.

 

Many thanks in advance.

{%- assign base_url_xvar = "https://localhost:3000/help?backTo=" -%}
<a href="{{base_url_xvar | append: page.url}}">
  {{ 'customer.login_page.create_account' | t }}
</a>

 

Replies 2 (2)

SB_90
Shopify Partner
216 52 70

Hi @Lindanarm 

 

From what I can tell, the code you have looks correct.

 

Have you tried this from multiple pages, and it's never appending the page.url part?

 

As a quick way of logging the items you're actually working with to the console, try adding this just before and seeing what you get for the page object the web browsers developer console maybe?

 

<script>console.log( {{ page| json }} );</script>

 

 

Lindanarm
Shopify Partner
6 1 0

Hi @SB_90,

 

thank you for your quick reply.

I logged 'page' like you said and it appears to be 'null'.

The strange thing is, when I simply use the 'page.url' as the ref it works, but not if I append it to another variable.

 

<a href="{{page.url}}"> 
  {{ 'customer.login_page.create_account' | t }} 
</a>