[Liquid]GETクエリの値を取得

参考:https://community.shopify.com/c/Shopify-Design/URL-Parameters-in-LIQUID/td-p/149761/page/2

function_get_query_value_by_key.liquid

{%- capture contentForQuerystring -%}{{ content_for_header }}{%- endcapture -%}
{%- assign pageUrl = contentForQuerystring | split:'"pageurl":"' | last | split:'"' | first | replace:'\/','/' | replace:'%20',' ' | replace:'\u0026','&' -%}
{%- assign get_query_value_by_key = '' -%}
{%- if pageUrl contains "?" -%}
    {%- assign pageQuerystring = pageUrl | split:'?' | last | replace:'=','&' -%}
    {%- assign tmp = pageQuerystring | split:'&' -%}
    {%- for kv in tmp -%}
        {%- if kv == key -%}
            {%- assign get_query_value_by_key = tmp[forloop.index] -%}
            {%- break -%}
        {%- endif -%}
    {%- endfor -%}
{%- endif -%}

使用時 typeの値を取得する

{%- include "function_get_query_value_by_key" key:"type" -%}
get_query_value_by_key:{{get_query_value_by_key}}