Last active
December 2, 2024 04:48
-
-
Save stephpolinar/3eb3c0fc2ff3c8841a93d5101715622f to your computer and use it in GitHub Desktop.
Get full URL of current page (including queries). Then noindex URLs with 'pr_prod_strat'
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- To be placed on theme.liquid WITHIN <head> tags --> | |
<!-- No index product recommendation URLs =========================================================== --> | |
{%- capture contentForQuerystring -%}{{ content_for_header }}{%- endcapture -%} | |
{%- assign pageUrl = contentForQuerystring | |
| split: '"pageurl":"' | |
| last | |
| split: '"' | |
| first | |
| split: '.myshopify.com' | |
| last | |
| replace: '\/', '/' | |
| replace: '%20', ' ' | |
| replace: '\u0026', '&' | |
-%} | |
{% capture finalurl %}https://{{ pageUrl }}{% endcapture %} | |
{% if finalurl contains 'pr_prod_strat' %} | |
<meta name="robots" content="noindex" /> | |
{% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment