Skip to content

Commit

Permalink
Merge pull request #17 from jacobwhall/og-fixes
Browse files Browse the repository at this point in the history
Fixes to Open Graph meta tags
  • Loading branch information
quincylvania authored Jan 16, 2025
2 parents 851e1cc + 9a189b4 commit b70f7fe
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions _includes/page_meta.html
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
<title>{%- if page.title or page.temp_title -%} {{page.temp_title | default: page.title}} | {% endif -%} {{site.title}}</title>
<meta name="og:title" content="{{page.temp_title | default: page.title}}">
<meta property="og:url" content="{{page.url | absolute_url }}">
{% assign description = page.content | strip_html | markdownify | strip_html | strip_newlines | truncate: 210 -%}
<meta name="title" property="og:title" content="{{page.temp_title | default: page.title}}">
<meta property="og:url" content="{{page.url | absolute_url }}">
{%- assign description = page.content | strip_html | markdownify | strip_html | strip_newlines | truncate: 210 -%}
{%- if page.temp_blurb or page.blurb -%}
{%- assign description=page.temp_blurb | default: page.blurb | strip_html | markdownify | strip_html -%}
{%- assign description=page.temp_blurb | default: page.blurb | strip_html | markdownify | strip_html | strip_newlines -%}
{% endif %}
<meta name="og:description" content="{{description}}">
<meta name="description" property="og:description" content="{{description}}">
{%- if page.youtube -%}
{%- assign youtube_image = "https://i3.ytimg.com/vi/" | append: page.youtube | append: "/hqdefault.jpg" -%}
{%- endif -%}
{%- assign image=page.social_banner | default: page.sign | default: page.image | default: page.cover | default: page.logo | default: youtube_image -%}
{%- if image %}
<meta name="og:image" content="{{image | absolute_url }}">
<meta name="og:image:url" content="{{image | absolute_url }}">
{% endif %}
<meta name="twitter:creator" content="{% if page.twitter %}@{{page.twitter}}{% else %}@{{site.twitter}}{% endif %}">
<script type="application/ld+json">
{
"@context" : "https://schema.org",
"@type" : "WebSite",
"name" : "{{site.title}}",
{% if site.short_title %} "alternateName" : "{{site.short_title}}", {%- endif %}
"url" : "{{site.url}}"
}
</script>
<meta name="image" property="og:image" content="{{image | absolute_url }}">
<meta property="og:image:url" content="{{image | absolute_url }}">
{%- endif %}
<meta name="twitter:creator" content="{% if page.twitter %}@{{page.twitter}}{% else %}@{{site.twitter}}{% endif %}">
<script type="application/ld+json">
{
"@context" : "https://schema.org",
"@type" : "WebSite",
"name" : "{{site.title}}",
{% if site.short_title %} "alternateName" : "{{site.short_title}}", {%- endif %}
"url" : "{{site.url}}"
}
</script>

{%- if page.image %}
<link rel="preload" href="{{ page.image | absolute_url }}" as="image"><!-- load the most prominent image first -->
Expand Down

0 comments on commit b70f7fe

Please sign in to comment.