Skip to content

Commit

Permalink
Fixes Shopify#3676 Delete unnecessary meta tags and re-order head ele…
Browse files Browse the repository at this point in the history
…ment
  • Loading branch information
cevdetardaharan committed Nov 26, 2024
1 parent 0ca9c65 commit d5788ca
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 63 deletions.
33 changes: 16 additions & 17 deletions layout/password.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,13 @@
<html class="js full-height" lang="{{ request.locale.iso_code }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="theme-color" content="">
<link rel="canonical" href="{{ canonical_url }}">

{%- if settings.favicon != blank -%}
<link rel="icon" type="image/png" href="{{ settings.favicon | image_url: width: 32, height: 32 }}">
{%- endif -%}
<title>{{ shop.name }}</title>

{%- unless settings.type_header_font.system? -%}
<link rel="preconnect" href="https://fonts.shopifycdn.com" crossorigin>
{%- endunless -%}

<title>{{ shop.name }}</title>

<meta name="description" content="{{ page_description | escape }}">

{% render 'meta-tags' %}

{{ content_for_header }}

{%- liquid
Expand Down Expand Up @@ -174,6 +162,10 @@
}
{% endstyle %}

{{ 'section-password.css' | asset_url | stylesheet_tag }}
{{ 'base.css' | asset_url | stylesheet_tag }}
{{ 'component-list-social.css' | asset_url | stylesheet_tag }}

{%- unless settings.type_body_font.system? -%}
{% comment %}theme-check-disable AssetPreload{% endcomment %}
<link rel="preload" as="font" href="{{ settings.type_body_font | font_url }}" type="font/woff2" crossorigin>
Expand All @@ -185,13 +177,20 @@
{% comment %}theme-check-enable AssetPreload{% endcomment %}
{%- endunless -%}

{{ 'section-password.css' | asset_url | stylesheet_tag }}
{{ 'base.css' | asset_url | stylesheet_tag }}
{{ 'component-list-social.css' | asset_url | stylesheet_tag }}

<script src="{{ 'global.js' | asset_url }}" defer="defer"></script>
<script src="{{ 'details-modal.js' | asset_url }}" defer="defer"></script>
<script src="{{ 'password-modal.js' | asset_url }}" defer="defer"></script>

{%- if settings.favicon != blank -%}
<link rel="icon" type="image/png" href="{{ settings.favicon | image_url: width: 32, height: 32 }}">
{%- endif -%}

<meta name="theme-color" content="">
<link rel="canonical" href="{{ canonical_url }}">

<meta name="description" content="{{ page_description | escape }}">

{% render 'meta-tags' %}
</head>

<body class="password gradient">
Expand Down
78 changes: 39 additions & 39 deletions layout/theme.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,7 @@
<html class="js" lang="{{ request.locale.iso_code }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="theme-color" content="">
<link rel="canonical" href="{{ canonical_url }}">

{%- if settings.favicon != blank -%}
<link rel="icon" type="image/png" href="{{ settings.favicon | image_url: width: 32, height: 32 }}">
{%- endif -%}

{%- unless settings.type_header_font.system? and settings.type_body_font.system? -%}
<link rel="preconnect" href="https://fonts.shopifycdn.com" crossorigin>
{%- endunless -%}

<title>
{{ page_title }}
Expand All @@ -22,25 +11,18 @@
{%- unless page_title contains shop.name %} &ndash; {{ shop.name }}{% endunless -%}
</title>

{% if page_description %}
<meta name="description" content="{{ page_description | escape }}">
{% endif %}

{% render 'meta-tags' %}

<script src="{{ 'constants.js' | asset_url }}" defer="defer"></script>
<script src="{{ 'pubsub.js' | asset_url }}" defer="defer"></script>
<script src="{{ 'global.js' | asset_url }}" defer="defer"></script>
<script src="{{ 'details-disclosure.js' | asset_url }}" defer="defer"></script>
<script src="{{ 'details-modal.js' | asset_url }}" defer="defer"></script>
<script src="{{ 'search-form.js' | asset_url }}" defer="defer"></script>

{%- if settings.animations_reveal_on_scroll -%}
<script src="{{ 'animations.js' | asset_url }}" defer="defer"></script>
{%- endif -%}
{%- unless settings.type_header_font.system? and settings.type_body_font.system? -%}
<link rel="preconnect" href="https://fonts.shopifycdn.com" crossorigin>
{%- endunless -%}

{{ content_for_header }}

<script>
if (Shopify.designMode) {
document.documentElement.classList.add('shopify-design-mode');
}
</script>

{%- liquid
assign body_font_bold = settings.type_body_font | font_modify: 'weight', 'bold'
assign body_font_italic = settings.type_body_font | font_modify: 'style', 'italic'
Expand Down Expand Up @@ -266,6 +248,15 @@
{{ 'component-discounts.css' | asset_url | stylesheet_tag }}
{%- endif -%}

{%- if settings.predictive_search_enabled -%}
<link
rel="stylesheet"
href="{{ 'component-predictive-search.css' | asset_url }}"
media="print"
onload="this.media='all'"
>
{%- endif -%}

{%- unless settings.type_body_font.system? -%}
{% comment %}theme-check-disable AssetPreload{% endcomment %}
<link rel="preload" as="font" href="{{ settings.type_body_font | font_url }}" type="font/woff2" crossorigin>
Expand All @@ -277,25 +268,34 @@
{% comment %}theme-check-enable AssetPreload{% endcomment %}
{%- endunless -%}

<script src="{{ 'constants.js' | asset_url }}" defer="defer"></script>
<script src="{{ 'pubsub.js' | asset_url }}" defer="defer"></script>
<script src="{{ 'global.js' | asset_url }}" defer="defer"></script>
<script src="{{ 'details-disclosure.js' | asset_url }}" defer="defer"></script>
<script src="{{ 'details-modal.js' | asset_url }}" defer="defer"></script>
<script src="{{ 'search-form.js' | asset_url }}" defer="defer"></script>

{%- if settings.animations_reveal_on_scroll -%}
<script src="{{ 'animations.js' | asset_url }}" defer="defer"></script>
{%- endif -%}

{%- if localization.available_countries.size > 1 or localization.available_languages.size > 1 -%}
{{ 'component-localization-form.css' | asset_url | stylesheet_tag: preload: true }}
<script src="{{ 'localization-form.js' | asset_url }}" defer="defer"></script>
{%- endif -%}

{%- if settings.predictive_search_enabled -%}
<link
rel="stylesheet"
href="{{ 'component-predictive-search.css' | asset_url }}"
media="print"
onload="this.media='all'"
>
{%- if settings.favicon != blank -%}
<link rel="icon" type="image/png" href="{{ settings.favicon | image_url: width: 32, height: 32 }}">
{%- endif -%}

<script>
if (Shopify.designMode) {
document.documentElement.classList.add('shopify-design-mode');
}
</script>
<meta name="theme-color" content="">
<link rel="canonical" href="{{ canonical_url }}">

{% if page_description %}
<meta name="description" content="{{ page_description | escape }}">
{% endif %}

{% render 'meta-tags' %}
</head>

<body class="gradient{% if settings.animations_hover_elements != 'none' %} animate--hover-{{ settings.animations_hover_elements }}{% endif %}">
Expand Down
12 changes: 5 additions & 7 deletions snippets/meta-tags.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
endif
%}

<meta name="twitter:card" content="summary_large_image">
{%- if settings.social_twitter_link != blank -%}
<meta name="twitter:site" content="{{ settings.social_twitter_link | split: 'twitter.com/' | last | prepend: '@' }}">
{%- endif -%}

<meta property="og:site_name" content="{{ shop.name }}">
<meta property="og:url" content="{{ og_url }}">
<meta property="og:title" content="{{ og_title | escape }}">
Expand All @@ -30,10 +35,3 @@
<meta property="og:price:amount" content="{{ product.price | money_without_currency | strip_html }}">
<meta property="og:price:currency" content="{{ cart.currency.iso_code }}">
{%- endif -%}

{%- if settings.social_twitter_link != blank -%}
<meta name="twitter:site" content="{{ settings.social_twitter_link | split: 'twitter.com/' | last | prepend: '@' }}">
{%- endif -%}
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="{{ og_title | escape }}">
<meta name="twitter:description" content="{{ og_description | escape }}">

0 comments on commit d5788ca

Please sign in to comment.