How To Install Optizen (Shopify 2.0)

Categories

How To Install Optizen (Shopify 2.0)

You are here:
< All Topics

Installing the Optizen app requires some changes to your theme code. Please make sure you duplicate (backup) your store theme prior to installing. If you don’t know how to do this, you can see a tutorial here:

https://help.shopify.com/en/manual/online-store/os/using-themes/managing-themes/duplicating-themes

Done For You Shopify 2.0 Installation:

We also offer an installation service if you are not comfortable with editing your theme files. If you would like to use this service, please submit a support ticket here of our developers will get back to you.

This service is free for paid app subscriptions.

Manually Install Yourself

IMPORTANT NOTE FOR BOTH FREE & PRO USERS:

If you have Optizen Version 1 installed (collection content only), you will need to first remove the existing line of code.

Navigate to collection.liquid in Templates

Cntrl + F and search for:

<div class="col_lower_main" style="width:100%"><div class="inner_lower_main" style="max-width:1170px;margin:0 auto;">{{ collection.metafields.collectionlower.lowerdata }}</div></div>

Delete this line of code and SAVE. Then complete the installation below.

FREE & PRO VERSION (SHOPIFY 2.0)

Files That Require Editing:

  • theme.liquid
  • collection.json /All Collection Template
  • – social-meta-tags.liquid

1) theme.liquid

Add the following code inside <head></head>

<!-- Optizen V2 -->
{% if template contains 'collection' and current_tags %}
{% assign index = shop.metafields.AllTagsIndex.all_tags_index %}
{% if index == 'index' %}
{% assign indexing = 'index' %}
{% elsif index == 'noindex' %}
{% assign indexing = 'noindex' %}
{%else%}
{% assign indexing = 'index' %}
{% endif %}
{% assign tag_index_key = current_tags[0] | handleize | prepend: 'f_' %}
{% if collection.metafields.TagIndex[tag_index_key] == 'index' %}
{% assign indexing = 'index' %}
{% elsif collection.metafields.TagIndex[tag_index_key] == 'noindex' %}
{% assign indexing = 'noindex' %}
{%else%}
{% assign indexing = 'noindex' %}
{% endif %}
{%if request.path contains '+'%}
{%assign indexing = 'noindex'%}
{%endif%}

<meta name='robots' content='{{indexing}}'/>
{% assign tag_seo_desc_key = current_tags[0] | handleize | prepend: 'c_' %}
{% assign tag_seo_title_key = current_tags[0] | handleize | prepend: 'a_' %}
{% assign seo_title = collection.metafields.TagSeoTitleData[tag_seo_title_key] %}
{% assign page_description = collection.metafields.TagSeoDesc[tag_seo_desc_key] | strip_html %}
{% endif %}
{{ 'optimizenup.css' | asset_url | stylesheet_tag }}

<!-- End Optizen V2 -->

Save the file.

2) collection.json / All Collection templates

Add the below-mentioned code in every collection template at the top of the code.

{% assign con_tent ='' %}
{% if template contains 'collection' and current_tags %}
{% assign tag_page_key = current_tags[0] | handleize| prepend: 'e_' %}
{% assign show_page = collection.metafields.TagShowContent[tag_page_key] %}
{% assign tag_desc_key = current_tags[0] | handleize | prepend: 'b_' %}

{% if show_page == 'all_pages' %}
{% assign con_tent = collection.metafields.TagDescTitle[tag_desc_key] %}
{% else %}
{% if current_page == 1 %}
{% assign con_tent = collection.metafields.TagDescTitle[tag_desc_key] %}
{% endif %}
{% endif %}
{% endif %}
{% if con_tent == ''%}
{%assign con_tent = collection.description%}
{%endif%}
<div class='col_upper_main' style='width:100%'>
<div class='inner_upper_main' style='max-width:1170px;margin:0 auto;'>
{{ con_tent }}
</div>
</div>

3) collection-template.liquid / Collection section

if your theme collection template contains any section for description.

find

{% if collection.description != blank %}

              <div class="rte">         

                  {{ collection.description }}

              </div>

{% endif %}

Replace with

{% assign collectiopn_c = '' %}

         

    {% if collection.description != blank %}

     {% assign collectiopn_c = collection.description %}          

    {% endif %}

    {% if template contains 'collection' and current_tags %}

      {% assign tag_description_key = current_tags[0] | handleize | prepend: 'b_' %}

      {% assign tag_description = collection.metafields.TagDescTitle[tag_description_key] %}

      {% assign collectiopn_c = tag_description %}

    {% endif %}

    <div class="rte collection-description page-width">

      {{collectiopn_c}}

    </div>

find

{{ collection.title }}

Replace with

{% if template contains 'collection' and current_tags %}

                  {% assign tag_desc_key = current_tags[0] | handleize | prepend: 'd_' %}

                      {{collection.metafields.TagTitleData[tag_desc_key]}}

 {% else %}

                  {{ collection.title }}

 {% endif %}

4) social-meta-tags.liquid /snippets

add this code in top of the file of social meta tags files, where og title and descriptions has been integrated.

{% if template contains 'collection' and current_tags %}

{% assign tag_seo_title_key = current_tags[0] | handleize | prepend: 'a_' %}

{% assign tag_seo_desc_key = current_tags[0] | handleize | prepend: 'c_' %} 

{% assign page_description = collection.metafields.TagSeoDesc[tag_seo_desc_key]  | strip_html  %}

{% assign page_title = collection.metafields.TagSeoTitleData[tag_seo_title_key] %}

{% endif %}

NOTE: If your theme does not contain this template, section and snippets. Please contact with app support.

Previous How To Uninstall Optizen
Table of Contents
LEARN WHY OPTIZEN IS ONE OF THE MOST POWERFUL SHOPIFY SEO APPS