Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more
Hi All,
I want to block a specific page URL from being crawled. I have tried using the theme.liquid and added this code but it didnt work:
{% if handle contains 'page-handle-you-want-to-exclude' %} <meta name="robots" content="noindex"> {% endif %}
I tried adding this to the robots.txt file
disallow: /a/XXXX
under user-agent, adsbot-google etc.
But this didnt work either.
Finally I tried this code at the bottom of robots txt but it also didn't work. Can someone help?
{%- if group.user_agent.value == ‘*’ -%} {{ ‘Disallow: [URLPath]‘ }} {%- endif -%}
I'm testing crawlability via this link and it keeps coming up saying it's crawled: https://search.google.com/test/rich-results/
Solved! Go to the solution
This is an accepted solution.
Please add domain.com/page/page.json to get the ID of the page
After that, please add this code to theme.liquid file
{% if page.id == page ID goes here %}
<meta name="robots" content="noindex, nofollow" />
{% endif %}
- Helpful? Like & Accept solution!
- Ryviu - Product Reviews & QA app: Collect customer reviews, import reviews from AliExpress, Amazon, Etsy, Walmart, Dhgate and CSV.
- Lookfy Gallery: Lookbook Image - Gain customers with photo gallery, video & shoppable image.
- Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- Enjoy 1 month of Shopify for $1. Sign up now.
Could you share that page link?
- Helpful? Like & Accept solution!
- Ryviu - Product Reviews & QA app: Collect customer reviews, import reviews from AliExpress, Amazon, Etsy, Walmart, Dhgate and CSV.
- Lookfy Gallery: Lookbook Image - Gain customers with photo gallery, video & shoppable image.
- Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- Enjoy 1 month of Shopify for $1. Sign up now.
I would prefer not to because of scammers/copiers etc.
It's just a URL on the site. like domain.com/page/page
@Dan-From-Ryviu can you please advise? you shouldn't need the URL. Lets just give it a name https:// domain.com/page
This is an accepted solution.
Please add domain.com/page/page.json to get the ID of the page
After that, please add this code to theme.liquid file
{% if page.id == page ID goes here %}
<meta name="robots" content="noindex, nofollow" />
{% endif %}
- Helpful? Like & Accept solution!
- Ryviu - Product Reviews & QA app: Collect customer reviews, import reviews from AliExpress, Amazon, Etsy, Walmart, Dhgate and CSV.
- Lookfy Gallery: Lookbook Image - Gain customers with photo gallery, video & shoppable image.
- Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- Enjoy 1 month of Shopify for $1. Sign up now.
@Dan-From-Ryviu appreciate the response, it doesn't seem to work, I just get "error occured on client". The page directory is domain.com/a/faq which renders the page. So if I add faq/page.json I get the error. if I do faq.json it is a 404?
You can easily get the page id from admin.
Open Online store then pages
Open the page in admin & check the URL You can see something like
https://admin.shopify.com/store/[your-store-name]/pages/1986285850919
that number is your page.id
Can anyone help please?