Skip to content

Commit b4091ec

Browse files
committed
Add gallery Open Graph metadata
1 parent 4d958d6 commit b4091ec

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

_layouts/base.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,16 @@
2424
<link rel="canonical" href="{{ current_url | escape }}">
2525
<link rel="icon" href="/favicon.svg" type="image/svg+xml">
2626
<link rel="alternate" type="application/rss+xml" title="cb341.dev RSS Feed" href="/rss.xml">
27+
{% if page.layout == "gallery" %}
28+
{%- assign gallery_description = page.description | default: page.content | markdownify | strip_html | normalize_whitespace | truncate: 160 -%}
29+
<meta property="og:description" content="{{ gallery_description | escape }}">
30+
{%- endif %}
31+
{% if page.image %}
32+
<meta property="og:image" content="{{ site_url }}{{ page.image | escape }}">
33+
{%- if page.alt %}
34+
<meta property="og:image:alt" content="{{ page.alt | escape }}">
35+
{%- endif %}
36+
{%- endif %}
2737
<script type="application/ld+json">
2838
{
2939
"@context": "https://schema.org",

0 commit comments

Comments
 (0)