@Caroline_Schnap I do not know if this is the right way to do this but I am getting URL with the parameter using following liquid code :
{% assign pageurl = content_for_header| split:'"pageurl":"' | last | split:'"' | first %}
@sydsfaisal you can try this.
@Papas_Pringles content_for_header is a global liquid object which contains header related common tags. In which there is a parameter pageurl which have the page URL and its parameter in it. Above mention code extract that page URL content from content_for_header object. So now after above line if you print {{ pageurl }} than it will print the URL which is hit with the parameter.
Just include the above mention code in your liquid code and try to use it. If you want to fetch parameter values from that variable than it requires some liquid filters on pageurl. Do let me know if you want that let me know, I will do the coding and let you know.
Hi @Caroline_Schnap, can you please tell me if URL Parameters have been added as described here? If not, can you please add me to the list?
Here is a real server-
@sydsfaisal wrote:hi
is there any luck for this issue ?? help i have same issue
side solution: https://freakdesign.com.au/blogs/news/get-the-url-querystring-values-with-liquid-in-shopify
Hi,
You can get value of page from the URL https://www.mydomain.com/mypage?page=3 using the below code.
{%- capture contentForQuerystring -%}{{ content_for_header }}{%- endcapture -%}
{%- assign page_url = contentForQuerystring | split:'"pageurl":"' | last | split:'"' | first | split:'.myshopify.com' | last | replace:'\/','/' | replace:'%20',' ' | replace:'\u0026','&' -%}
{%- assign param_page = '' -%}
{%- for i in (1..1) -%}
{%- unless page_url contains "?" -%}{% break %}{%- endunless -%}
{%- assign query_string = page_url | split:'?' | last -%}
{%- assign qry_parts= query_string | split:'&' -%}
{%- for part in qry_parts -%}
{%- assign key_and_value = part | split:'=' -%}
{%- if key_and_value.size > 1 -%}
{% if key_and_value[0] == 'page' %}
{%- assign param_page = key_and_value[1] -%}
{% endif%}
{%- endif -%}
{%- endfor -%}
{%- endfor -%}
Page value = {{ param_page }}
Hope this helps other developers.
What I have done to solve the cache issue is to provide a dummy `sort_by=` query string. I noticed the cache always clears when you update its value.
{% assign pageurl = content_for_header | split:'"pageurl":"' | last | split:'"' | first %}
Use like this:
http://my-store.myshopify.com/pages/about?sort_by=fake
User | Count |
---|---|
546 | |
213 | |
129 | |
81 | |
44 |