Hardcoding logo file in header.liquid isn't working

Hardcoding logo file in header.liquid isn't working

pramodraam
Shopify Partner
77 2 9

I don't see a reason why the header logo file hardcoded in header.liquid is not being recognized. Code is below. Please look at this line in the code. sourceLogoFile is the variable that holds the logo file that I manually assigned. 

			{%- elsif settings.logo != blank -%}
				<img src="{{ sourceLogoFile | img_url: logoWidth }}" width="{{settings.logo_width}}" height="{{settings.logo_width | divided_by: settings.logo.aspect_ratio | floor}}" alt="{{ settings.logo.alt | default: shop.name }}" srcset="{{ sourceLogoFile | img_url: logoWidth, scale: 1 }} 1x, {{ sourceLogoFile | img_url: logoWidth, scale: 2 }} 2x">

 

	{% comment %}
		Automation of logo updating follows the steps below.
		1. A Cronjob on POMS/PMM server runs at the dawn.
		2. An API call is made to Shopify to pass logo tag and logo event date info.
		3. The passed data is stored in shop level metafields generated by the API.
		4. Fields are A. shop.metafields.pmm.logo_tag}} 2. {{shop.metafields.pmm.logo_date_info}}
		5. Get full logo file name from Shopify file section based on the logo_tag meta field content.
		6. Use case to assign logo file name to a variable based on the logo_tag
	{% endcomment %}
	{% assign sourceLogoFile = 'PMM_512_rec_R_f235cc1b-7359-44c9-82bd-6d2ad198e1ce.png' %}
	{%- if shop.metafields.pmm.logo_tag != "normal" -%}
		{% case shop.metafields.pmm.logo_tag %}
			{% when 'valentine' %}{%- assign sourceLogoFile = 'logoVALENTINE.png' -%}
			{% when 'spatricks' %}{%- assign sourceLogoFile = 'logoSTPATRICKS.png' -%}
			{% when 'easter' %}{%- assign sourceLogoFile = 'logoEASTER.png' -%}
		{% endcase %}
	{%- endif -%}

	{%- if shop.metafields.pmm.logo_date_info -%}
		{% assign eventDate = shop.metafields.pmm.logo_date_info %}
	{%- endif -%}

		<a href="{{ routes.root_url }}" class="header-logo-link">
			{%- if settings.home_classic and template == 'index' and settings.logo_cl != blank -%}
				<img src="{{ settings.logo_cl | img_url: logoWidth }}" width="{{settings.logo_width}}" height="{{settings.logo_width | divided_by: settings.logo_cl.aspect_ratio | floor}}" class="cllogo" alt="{{ settings.logo_cl.alt | default: shop.name }}" srcset="{{ settings.logo_cl | img_url: logoWidth, scale: 2 }} 1x, {{ settings.logo_cl | img_url: logoWidth, scale: 4 }} 1.1x">
                {%- if settings.logosvg != blank -%}
              		{{settings.logosvg | replace: '<svg', '<svg class="stlogo"' }}
          		{%- else settings.logo != blank -%}
							<img src="{{ settings.logo | img_url: logoWidth }}" width="{{settings.logo_width}}" height="{{settings.logo_width | divided_by: settings.logo.aspect_ratio | floor}}" class="stlogo" alt="{{ settings.logo.alt | default: shop.name }}" srcset="{{ settings.logo | img_url: logoWidth, scale: 2 }} 1x, {{ settings.logo | img_url: logoWidth, scale: 4 }} 1.1x">
                {%- endif -%}
			{%- elsif settings.logosvg != blank -%}
				{{settings.logosvg }}
			{%- elsif settings.logo != blank -%}
				<img src="{{ sourceLogoFile | img_url: logoWidth }}" width="{{settings.logo_width}}" height="{{settings.logo_width | divided_by: settings.logo.aspect_ratio | floor}}" alt="{{ settings.logo.alt | default: shop.name }}" srcset="{{ sourceLogoFile | img_url: logoWidth, scale: 1 }} 1x, {{ sourceLogoFile | img_url: logoWidth, scale: 2 }} 2x">
			{%- else -%}
				{{ shop.name }}
			{%- endif -%}
			<span class="v-hidden">{{ shop.name }}</span>
		</a>
	</{% if template == 'index'%}h1{% else %}div{% endif %}>
{%- endcapture -%}
{%- capture textblock -%}
	{%- if settings.hdTxt-block contains "[social-icons]"-%}
		{%- assign headerTxt = settings.hdTxt-block | split: "[social-icons]" -%}
		{{headerTxt[0]}} {% render 'social-media' %} {{headerTxt[1]}}
	{%- else -%}
		{{ settings.hdTxt-block }}
	{%- endif -%}
{%- endcapture -%}
<div id="header" data-section-id="header" data-section-type="header-section" {% if settings.home_classic and template == "index" %}class="classic-style"{% endif %}>
		<header class="site-header fl f-aic {{settings.align_logo}}{% if settings.nav_below_logo %} nav-below{% endif %}{% if settings.main_header_fullwidth %} fullwidth{% else %} page-width{% endif %}">
			<div class="mobile-nav hide-lg">
				<a href="#" class="hdicon js-mobile-nav-toggle open" title="{{ 'layout.navigation.menu' | t }}"><i class="at at-bars-l" aria-hidden="true"></i></a>
				{% if settings.enable_search %}
              		<a href="{{ routes.search_url }}" class="hdicon searchIco" title="{{ 'general.search.tool_tip' | t }}"><i class="at at-search-l"></i></a>
                {% endif %}
			</div>
			{%- if settings.align_logo == "left" -%}{{logo}}{%- endif -%}
			{%- if settings.nav_below_logo -%}
				<div class="txtBlock hide-sm hide-md{% if settings.align_logo == "left" %} tc{% endif %}">{{textblock}}</div>
			{%- else -%}
				{{desktopnav}}
			{%- endif -%}
			{% if settings.align_logo == "center" %}{{logo}}{% endif %}
				<div class="icons-col fl f-jce f-aic">
                  	{% if settings.enable_search %}
						<a href="{{ routes.search_url }}" class="hdicon searchIco hide-sm hide-md" title="{{ 'general.search.tool_tip' | t }}"><i class="at at-search-l"></i></a>
                  	{% endif %}
                  
                    {% unless settings.hide_login %}
                  	{% if shop.customer_accounts_enabled or settings.show_multiple_currencies or settings.show_language %}
					<a href="{{ routes.account_url }}" class="hdicon site-settings" title="{{ 'layout.header_settingbox.icon_tooltip' | t }}">
                     <i class="{{ settings.my_account_icn }}"></i> 
                    </a> 
                  	{% endif %}
                    {% render 'customer-links' %}                  
                  	{% endunless %}
                  
					{% if settings.enable_wishlist %}<a href="{{pages[settings.wishlist_page].url}}" class="hdicon wishlist hide-sm hide-md" title="{{ 'products.wishlist.title' | t }}"><i class="at at-heart-l"></i><span class="favCount hide">0</span></a>{% endif %}
					{%- unless settings.catalogmode -%}
                        <a href="{{ routes.cart_url }}" id="cartLink" class="hdicon{% if settings.ajax_cart %} header-cart{% endif %}" title="{{ 'layout.cart.title' | t }}">
                            <i class="at at-{{settings.icon_style}}"></i> <span id="CartCount" class="site-header__cart-count">{{ cart.item_count }}</span>
                        </a>
                    {%- endunless -%}
				</div>
		</header>
		{%- if settings.nav_below_logo -%}{{desktopnav}}{%- endif -%}
</div>
<div class="stickySpace"></div>
{%- if settings.snow_effect -%}</div>{%- endif -%}
{{mobilenav}}
{%- endcapture -%}
{{siteHeader | strip_newlines | remove: "  " | remove: "	" }}

 

 

 

I've a dozen of image files for the header logo uploaded to Shopify. 

Replies 0 (0)