Skip to content

Commit

Permalink
test new head.html
Browse files Browse the repository at this point in the history
  • Loading branch information
bigsk1 committed Jan 19, 2024
1 parent ab3f658 commit 7f231da
Showing 1 changed file with 14 additions and 34 deletions.
48 changes: 14 additions & 34 deletions _includes/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,42 +13,22 @@
{% seo title=false %}
{%- endcapture -%}

<!-- Setup Open Graph image -->

{% if page.image %}
{% assign src = page.image.path | default: page.image %}

{% unless src contains '://' %}
{%- capture img_url -%}
{{ src | absolute_url }}
{%- endcapture -%}

{%- capture og_image -%}
<meta property="og:image" content="{{ img_url }}" />
<meta name="twitter:image" content="{{ img_url }}" />
{%- endcapture -%}

{% assign old_meta_clip = '<meta name="twitter:card"' %}
{% assign new_meta_clip = og_image | append: old_meta_clip %}
{% assign seo_tags = seo_tags | replace: old_meta_clip, new_meta_clip %}
{% endunless %}
<!-- SEO Tags -->
{% seo title=false %}

<!-- Setup Open Graph and Twitter image -->
{% if page.image %}
{% assign src = page.image.path | default: page.image %}
{% unless src contains '://' %}
{% assign img_url = src | absolute_url %}
<meta property="og:image" content="{{ img_url }}" />
<meta name="twitter:image" content="{{ img_url }}" />
{% endunless %}
{% elsif site.social_preview_image %}
{%- capture img_url -%}
{{ site.social_preview_image | absolute_url }}
{%- endcapture -%}

{%- capture og_image -%}
<meta property="og:image" content="{{ img_url }}" />
<meta name="twitter:image" content="{{ img_url }}" />
{%- endcapture -%}

{% assign old_meta_clip = '<meta name="twitter:card"' %}
{% assign new_meta_clip = og_image | append: old_meta_clip %}
{% assign seo_tags = seo_tags | replace: old_meta_clip, new_meta_clip %}
{% endif %}

{{ seo_tags }}
{% assign img_url = site.social_preview_image | absolute_url %}
<meta property="og:image" content="{{ img_url }}" />
<meta name="twitter:image" content="{{ img_url }}" />
{% endif %}

<title>
{%- unless page.layout == 'home' -%}
Expand Down

0 comments on commit 7f231da

Please sign in to comment.