How To Install Optizen

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 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 contact apps@ecomxseo.com and one of our developers will get back to you. 

This service is free for paid app subscriptions.

Manually Install Yourself

Files That Require Editing:

– theme.liquid

– collection.liquid /All Collection Templates

– collection-template.liquid

– social-meta-tags.liquid

1) theme.liquid – In Layout

Add the below code inside the <head> 

{% if template contains 'collection' and current_tags %}
	{% assign index = shop.metafields.AllTagsIndex.all_tags_index %}
	{% if index == 'index' %}
		{% assign indexing = 'index' %}
	{% else %}
		{% assign indexing = 'noindex' %}
	{% endif %}
	{% assign tag_index_key = current_tags[0] | prepend: 'f_' %}
	{% if shop.metafields.TagIndex[tag_index_key] == 'index' %}
		{% assign indexing = 'index' %}
	{% else %}
	{% assign indexing = 'noindex' %}
	{% endif %}
	<meta name='robots' content='{{indexing}}'/>
	{% assign tag_seo_desc_key = current_tags[0] | prepend: 'c_' %}
	{% assign tag_seo_title_key = current_tags[0] | prepend: 'a_' %}
	{% assign seo_title = shop.metafields.TagSeoTitleData[tag_seo_title_key] %}
	{% assign page_description = shop.metafields.TagSeoDesc[tag_seo_desc_key]  | strip_html  %}
	{% endif %}
{{ 'optimizenup.css' | asset_url | stylesheet_tag }}

2) collection.liquid – In Templates

Add the below code in every collection template.

{% assign con_tent ='' %}
{% if template contains 'collection' and current_tags %}
	{% assign tag_page_key = current_tags[0] | prepend: 'e_' %}
	{% assign show_page = shop.metafields.TagShowContent[tag_page_key] %}
	{% assign tag_desc_key = current_tags[0] | prepend: 'g_' %}
	{% if show_page == 'all_pages' %}		
		{% assign con_tent = shop.metafields.TagData[tag_desc_key] %}
	{% else %}
		{% if current_page == 1 %}
			{% assign con_tent = shop.metafields.TagData[tag_desc_key] %}
		{% endif %}
	{% endif %}
{% else %}
	{% if collection.metafields.collectionlower.show_content == 'all_pages' %}
		{% assign con_tent =  collection.metafields.collectionlower.lowerdata %}
	{% else %}
		{% if current_page == 1 %}
			{% assign con_tent =  collection.metafields.collectionlower.lowerdata %}
		{% endif %}
	{% endif %}
{% endif %}
<div class='col_lower_main' style='width:100%'>
	<div class='inner_lower_main' style='max-width:1170px;margin:0 auto;'>
		{{con_tent}}
	</div>
</div>

3) collection-template.liquid – In Sections

If your theme collection template contains any section for description.

find (Cntrl + F)

{% if collection.description != blank %}
              <div class="rte">         
                  {{ collection.description }}
              </div>
{% endif %}

replace with

{% if collection.description != blank %}
        <div class="rte collection-description page-width">
          {% if template contains 'collection' and current_tags %}
	 {% assign tag_description_key = current_tags[0] | prepend: 'b_' %}
	{% assign tag_description = shop.metafields.TagDescTitle[tag_description_key] %}
{% else %} 
	 {{ collection.description }} 
{% endif %}

find

{{ collection.title }}

replace

{% if template contains 'collection' and current_tags %}
	{% assign tag_desc_key = current_tags[0] | prepend: 'd_' %}
	 {{shop.metafields.TagData[tag_desc_key]}}
{% else %}
	{{ collection.title }}
{% endif %}

4) social-meta-tags.liquid In Snippets

  • add the code below, at the  top of the file:
{% if template contains 'collection' and current_tags %}
	{% assign tag_seo_title_key = current_tags[0] | prepend: 'a_' %}
	 {% assign tag_seo_desc_key = current_tags[0] | prepend: 'c_' %} 
	 {% assign page_description = shop.metafields.TagSeoDesc[tag_seo_desc_key]  | strip_html  %}
	 {% assign page_title = shop.metafields.TagSeoTitleData[tag_seo_title_key] %}
{% endif %}

If your theme does not contain these templates, sections and snippets, please contact app support:: apps@ecomxseo.com

Next How To Uninstall Optizen
Table of Contents