How to add OG meta to Shopify descriptions? - automation

How can I automatically add the OG meta description from Twitter to the meta description in Shopify?
<meta property="og:description" content="here is the meta description i want to automatically add to the shopify description for every product.">

{%- if template_base == 'product' -%}
<meta property="og:description" content="here is the meta description i want to automatically add to the shopify description for every product.">
{%- endif -%}
you can add this code to theme.liquid

Related

Limit number of tags in content

there is that old blog post to get a list of categories and tags from the content.
I only found tag_cloud as the only plugin dealing with tags no further mention in the documentation
Is there any way to limit the usable tags e.g. through the configs ?
One option is you can define a ALLOWED_TAGS variable in pelicanconf.py to contain the tags that you want to allow, then in places where tags are placed you can add a JINJA if block to allow only these tags
#pelicanconf.py
...
ALLOWED TAGS = ("tag1", "tag2", "tag3", tag4")
Example of generating tags for an article below
<div class="article-tags">
{% for tag in article.tags %}
{% if tag in ALLOWED_TAGS %}
<{{tag}}</span>
{% endif %}
{% endfor %}
</div>

How to breadcrumbs get all collection name and url in Shopify?

I am beginner Shopify developer, I have customise collection.liquid page. How to customise breadcrumb show selected collection name?
You can use this documentation.
The title number 5 show how to use breadcrumb for collection page, look :
{% elsif template contains 'collection' and collection.handle %}
[...]
{% elsif ... %}

Hide the catalog page on Shopify

Is there a way to hide the catalog page in Shopify? Here is more detail about the Shopify catalog page.
You might add an automatic javascript redirection to home when collection URL contains 'all'.
So this could be something like this in collection template in your theme :
{% if collection.handle == 'all' %}
<script>window.location.href = '{{ shop.url }}';</script>
{% else %}
Usual code for collection template display if this is not the 'all' collection.
{% endif %}
Please note that is NOT RECOMMENDED practice.
For example, if your customer has disabled Javascript, the page content will be blank as redirection won't work.
A better practice would be to not index page in search engines, so if there is no internal link and if search engines do not index it, no one will see it.
To do that, open the 'theme.liquid' template, and then, add this in <head> section :
{% if collection.handle == 'all' %}
<meta name="robots" content="noindex">
{% endif %}
HTH
Can you please give us a little more details about what you want ? If you want to remove the catalog from main menu , you need to go to Online store > navigation > find the main menu and remove catalog from there. That will remove the menu named catalog from your theme.
https://help.shopify.com/manual/sell-online/online-store/menus-and-links
If you donot want to show any product in the catalog page, you need to go to Online store > themes > edit html/css of the active theme and modify the collection.liquid to remove the section that displays the products.
Give us more details so that we can help you properly.
From the link you provided:
All Shopify stores have a page at the URL your-store.com/collections/all that lists all of the visible products in the store. This is the store's catalog page. By default, products on the catalog page are shown in alphabetic order. You can create a collection to control the order in which your products are shown on this page.
If you want to hide / remove that page altogether, you need to do a few things:
Create a collection to control your catalog page, as described via that same link,
Redirect it so that anyone that visits the page gets taken somewhere else e.g. your homepage. You can use the snippet below, based on this excellent answer for "Redirect[ing] from an HTML page" [or, in this case, a Liquid template:]
{%- layout none -%}
{%- assign title = "Nothing to See Here!" -%}
{%- assign url = shop.url -%}
<!DOCTYPE HTML>
<html lang="en-US">
<head>
{%- include 'head-meta' -%}
<meta http-equiv="refresh" content="1;url={{ url }}">
<script type="text/javascript">
window.top.location.href = "{{ url }}"
</script>
</head>
<body>
<h1>{{ page_title }}</h1>
<p>If you are not redirected automatically, follow the link.</p>
</body>
</html>
Remove it from the sitemap. You can do that (for this Collection or any Shopify resource) using my answer here — tl;dr add a metafield.seo.hidden with value 1.

How to Add Meta tags in Shopify Theme Site?

I have a site designed in Shopify platform But unable to insert Meta Title, Description, Keywords.
Also I want to implement Meta Tags in its pages & products. But don't know how to add them?
If you based your theme on one of the standard ones you should see some tags in the main layout like:
{% if page_description %}
<meta name="description" content="{{ page_description | escape }}">
{% endif %}
If not you can add it and get a meta tag.
If you want to add more info you'll need decide where the info is going to come from and code your theme accordingly. Again if you based your theme on a standard theme your main layout may have a snippet reference for open-graph-tags. If you edit open-graph-tags.liquid you will see one way to manage conditional meta tags.
In a nutshell you'd put something like the following in your theme header where XXX is the field that has your keywords. (maybe use a metafield for this?) :
{% if template contains 'product' %}
<meta name="keywords" content="{{ product.XXX | strip_html | escape }}">
{% endif %}

Multiple linklists on shopify categories (sidebar)

Yet another shopify question. I have a sidebar on shop/collections page
settings.sidebar_categoryblock_linklist
Which shows links to my main collecions: men/woman/kinds ect.
Yet I have another collection list based on product tags:
Winter/Autumn/Casual/Business etc
How do I get to display them on the sidebar? Meaning how can I put several linklists as categories link lists?
Thanks in advance
Julia
In a collection page, you have access to all the tags (unique) that the products have. You can use these tags to see if the belong to any collection and then display them. The code is as follows:
{% for tag in collection.all_tags %}
{% assign c_collection = collections[tag] %} // c_collection is used so the current display page's collection doesn't get disturbed
{% if c_collection.title != '' %}
{{ tag | link_to: c_collection.url,c_collection.title }} // not sure about this, but you can use proper html as well here
{% endif %}
{% endfor %}