Hide specific Shopify Page on search engines - shopify

I have pages I want to hide on search engines. I successfully hide those pages on Google, however, it is still showing on Bing and Yahoo engines.
What do I need to do to hide those pages on all search engines?

From your Shopify admin, go to Online Store > Themes.
Find the theme you want to edit, click the ... button to open the actions menu, and then click Edit code.
Click the theme.liquid layout file.
To exclude the search template, paste the following code in the section:
{% if template contains 'search' %}
<meta name="robots" content="noindex">
{% endif %}
To exclude a specific page, paste the following code in the section:
{% if handle contains 'page-handle-you-want-to-exclude' %}
<meta name="robots" content="noindex">
{% endif %}
Make sure that you replace page-handle-you-want-to-exclude with the correct page handle.
Click Save.
More
https://help.shopify.com/en/manual/promoting-marketing/seo/hide-a-page-from-search-engines

Related

How to check page is cart page or not in Shopify

How can I check if the current page is the cart page or not in front side?
I try to find page type using ShopifyAnalytics.meta.page.pageType. This works for all pages (like product and collection page) but doesn't work for cart page.
If you have any idea, please give answer.
add this condition
{% if template == 'cart' %}
//your code here
{% endif %}

How to use a Shopify Section across a Layout?

I have a section with content that can be edited from the Shopify Customizer. I use this section across multiple pages, but the content remains the same.
Is there a way to instead bind this section to a whole layout?
Because when you update the content, you have it re-enter it on every single page template that uses this section. I can have static HTML across all page templates that use a layout, but this isn't useful because the content needs to be editable from the Shopify Customizer.
You can have a section across a layout after all.
I was doing
layout/my-new-layout.liquid:
{% render 'section-component.liquid' %}
when I was supposed to be doing
layout/my-new-layout.liquid:
{% section 'section-component.liquid' %}
For reference
If you're trying to convert a template-only section to a layout-only section...
Remove the section JSON data from the template: templates/page.your-template.json.
Add a {% section 'your-section' %} in the layout (i.e. layout/my-new-layout.liquid).

How to Add Header and Footer in Grav CMS

I know how to add content in Grav CMS but i am facing problem in how to add a header section in Grav CMS. Please tell me where do i have to write the code for header and footer. In (.md) files or twig files?
As domsson already noted, there are more than a single way to do it in Grav
You can check implementation of it in (default) Quark theme:
templates/partials/base.html.twig, which is used by all other templates, have in needed location {% include 'partials/footer.html.twig' %} and footer.html.twig, in turn, contain all needed data for rendering on page
You can also see (use) idea from Open Publishing Space skeleton
{# display footer markdown page - hibbittsdesign.org #}
{% set content = pages.find('/footer').content %}
{% if content %}
{{ content|raw }}
{% endif %}
Here ordinary page (/footer) from site (editable as much as needed) used instead of template and have anything in it, it's content used as site-footer
If you have site with modular-pages only (like, f.e. Deliver skeleton), you can also (except using base-template as per p.1) add to all modular-collections
content:
items: #self.modular
…
page, which share common template (and data)

How to Add noindex for specific page in Shopify store

I have a Shopify store and I want to block search engines to index some products pages, I found this solution https://help.shopify.com/en/manual/promoting-marketing/seo/hide-a-page-from-search-engines?utm_source=gurucopy&utm_medium=link&utm_campaign=Gurus#undefined
{% if handle contains 'page-handle-you-want-to-exclude' %}
<meta name="robots" content="noindex">
{% endif %}
but I don't how I should make changes to block my pages
below my page link
mysite.com/products/product-26
mysite.com/products/kalita
Thank You
There is very handy way for doing it.. It works like a charm.. You can make use of metafields property for products provided by Shopify (look for tool called ShopifyFD for Google Chrome)
Create a metafield for the product(s) you want to hide from Google. Have a metafield with namespace as "seo" and key as "robots" and give value as "noindex" or "noindex, nofollow" based on what you need and "Save"
Now in your theme.liquid in head section, add the following
{% if product and product.metafields.seo and product.metafields.seo.robots %}
<meta name="robots" content="{{ product.metafields.seo.robots }}">
{% endif %}
Shopify have an API guide for doing this: Hide a resource from search engines and sitemaps:
POST /admin/api/2019-10/products/#{id}/metafields.json
{
"metafield": {
"namespace": "seo",
"key": "hidden",
"value": 1,
"value_type": "integer"
}
}
You might also want to check out their Developer Tools app, if you are using macOS — that will allow you to perform the post request, after you have authenticated using private app creds.

How to edit content on pages for Collection Tags in Shopify

When creating Collections in Shopify I can easily add Tags to them, which are then displayed on the Collections pages (in most of the themes I've used so far). The Collections page will typically show all the Tags for any Product within that Collection.
If you click the Tag it will go to a new page. I'm trying to find a way to edit those pages - it does not appear that this ability is built into Shopify, so I'm looking for the best solution.
There are easily over a hundred tags on this site too. My hope is to avoid writing a ton of conditional statements, but I fear that may be my only option.
Liquid - Example of what I'm thinking:
{% if current_tags == 'tag-name' %}
unique content for that tag
{% endif %}
Can anyone point me in a better direction?
The solution was simpler than I thought. I was using == when I should have been using 'contains'. Not that if your tags use spaces then you should type them exactly the same vs adding dashes to fill spaces.
Example:
{% if current_tags contains 'My Tag' %}
<!-- Custom HTML goes here -->
{% endif %}