Skip to content

Commit 795b3be

Browse files
committed
Alternate between OpenGraph types 'article' and 'website'
1 parent 0cba040 commit 795b3be

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

website/templates/layout.html

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,13 @@
5656
{%- set c_page_summary = 'godot-rust' -%}
5757
{%- set c_page_image = get_url(path='godot-ferris-og-dark.png') -%}
5858

59+
{#- For articles (that have a summary), use 'article' type, otherwise 'website' -#}
60+
{% if page.extra.summary %}
61+
{%- set c_page_type = 'article' -%}
62+
{% else %}
63+
{%- set c_page_type = 'website' -%}
64+
{% endif %}
65+
5966
{# Page title #}
6067
<title>
6168
{%- block title -%}
@@ -71,13 +78,13 @@
7178

7279
<!-- Discord, Facebook, etc. -->
7380
<meta property="og:url" content="{{ get_url(path='.') | safe }}">
74-
<meta property="og:type" content="website">
81+
<meta property="og:type" content="{{ c_page_type }}">
7582
<meta property="og:title" content="{{ c_page_title }}">
7683
<meta property="og:description" content="{{ c_page_summary }}">
7784
<meta property="og:image" content="{{ c_page_image | safe }}">
7885

7986
<!-- Twitter Meta Tags -->
80-
<meta name="twitter:card" content="summary_large_image">
87+
<meta name="twitter:card" content="summary"> {# or 'summary_large_image' #}
8188
<meta property="twitter:domain" content="godot-rust.github.io">
8289
<meta property="twitter:url" content="{{ get_url(path='.') | safe }}">
8390
<meta name="twitter:title" content="{{ c_page_title }}">

0 commit comments

Comments
 (0)