Created
April 25, 2012 13:36
-
-
Save resistorsoftware/2489750 to your computer and use it in GitHub Desktop.
Meta Tagger for Responsive
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
<link rel="canonical" href="{{ canonical_url }}" /> | |
{% assign maxmeta = 155 %} | |
{% if template contains 'product' %} | |
{% if collection %} | |
<link rel="canonical" href="{{ shop.url }}{{ product.url }}" /> | |
{% endif %} | |
{% assign mf = product.metafields.meta_data %} | |
{% unless mf == empty %} | |
{% for mf in product.metafields.meta_data %} | |
{% capture key %}{{ mf | first }}{% endcapture %} | |
{% if key == 'title' %} | |
<title>{{mf | last}}</title> | |
<meta name="title" content="{{mf | last}}" /> | |
{% endif %} | |
{% if key == 'meta_description' %} | |
<meta name="description" content="{{mf | last}}" /> | |
{% endif %} | |
{% if key == 'keywords' %} | |
<meta name="keywords" content="{{mf | last}}" /> | |
{% endif %} | |
{% endfor %} | |
{% else %} | |
<title>{% if page_title != '' %}{{ page_title | escape }}{% else %}{{product.title}}{% endif %}</title> | |
<meta name="description" content="{{product.description | strip_html | strip_newlines | truncate: maxmeta | escape}}" /> | |
{% endunless %} | |
{% elsif template contains 'page' %} | |
{% assign mf = page.metafields.meta_data %} | |
{% unless mf == empty %} | |
{% for mf in page.metafields.meta_data %} | |
{% capture key%}{{ mf | first }}{%endcapture%} | |
{% if key == 'title' %} | |
<title>{{mf | last}}</title> | |
<meta name="title" content="{{mf | last}}" /> | |
{% endif %} | |
{% if key == 'meta_description' %} | |
<meta name="description" content="{{mf | last}}" /> | |
{% endif %} | |
{% if key == 'keywords' %} | |
<meta name="keywords" content="{{mf | last}}" /> | |
{% endif %} | |
{% endfor %} | |
{% else %} | |
<title>{% if page_title != '' %}{{ page_title | escape }}{% else %}{{page.title}}{% endif %}</title> | |
<meta name="description" content="{{page.content | strip_html | strip_newlines | truncate: maxmeta | escape}}" /> | |
{% endunless %} | |
{% elsif template contains 'collection' %} | |
{% assign mf = collection.metafields.meta_data %} | |
{% unless mf == empty or mf == nil %} | |
{% for mf in collection.metafields.meta_data %} | |
{% capture key%}{{ mf | first }}{%endcapture%} | |
{% if key == 'title' %} | |
<title>{{mf | last}}</title> | |
<meta name="title" content="{{mf | last}}" /> | |
{% endif %} | |
{% if key == 'meta_description' %} | |
<meta name="description" content="{{mf | last}}" /> | |
{% endif %} | |
{% if key == 'keywords' %} | |
<meta name="keywords" content="{{mf | last}}" /> | |
{% endif %} | |
{% endfor %} | |
{% else %} | |
<title>{{ shop.name }} - {% if page_title != '' %}{{ page_title | escape }}{% else %}{{collection.title}}{% endif %}</title> | |
<meta name="description" content="{{collection.description | strip_html | strip_newlines | truncate: maxmeta | escape}}" /> | |
{% endunless %} | |
{% elsif template contains 'index' %} | |
<title>{% if template contains "index" %}{{ pages[settings.homepage].title }}{% elsif template contains "404" %}Page Not Found{% else %}{{ page_title | escape }}{% endif %}{% if current_page != 1 %} Page {{ current_page }}{% endif %}{% if template contains "index" and settings.homepage == blank %}{% else %} | {% endif %}{{ shop.name }}</title> | |
{% if shop.description != '' %} | |
<meta name="description" content="{{shop.description | escape }}" /> | |
{% endif %} | |
{% elsif template contains 'blog' %} | |
<title>{% if page_title != '' %}{{ page_title | escape }}{% else %}{{ blog.title }} {{ shop.name }}{% endif %}</title> | |
<meta name="description" content="{{ shop.name }} {{ blog.title | escape }} blog" /> | |
{% elsif template contains 'article' %} | |
<title>{% if page_title != '' %}{{ page_title | escape }}{% else %}{{ shop.name }} - {{ article.title }}{% endif %}</title> | |
<meta name="description" content=" {{ article.excerpt_or_content | strip_html | strip_newlines | escape | truncate: maxmeta }}" /> | |
{% else %} | |
<title>{% if template contains "index" %}{{ pages[settings.homepage].title }}{% elsif template contains "404" %}Page Not Found{% else %}{{ page_title | escape }}{% endif %}{% if current_page != 1 %} Page {{ current_page }}{% endif %}{% if template contains "index" and settings.homepage == blank %}{% else %} | {% endif %}{{ shop.name }}{% if template == "404" %} ==> Page Not Found <== {% endif %}</title> | |
{% if shop.description != '' %} | |
<meta name="description" content="{{shop.description | escape }}" /> | |
{% endif %} | |
{% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment