Skip to content

Commit 286bf77

Browse files
committed
#3097 update SEO organization, add og_description to _config.yml
1 parent a2dee16 commit 286bf77

File tree

2 files changed

+39
-31
lines changed

2 files changed

+39
-31
lines changed

_config.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,8 @@ facebook:
137137
username :
138138
app_id :
139139
publisher :
140-
og_image : # Open Graph/Twitter default site image
140+
og_image : # Social media default site image
141+
og_description : # Social media default site image description
141142
# For specifying social profiles
142143
# - https://developers.google.com/structured-data/customize/social-profiles
143144
social:

_includes/seo.html

Lines changed: 37 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,12 @@
3939
{% assign seo_author_twitter = seo_author_twitter | replace: "@", "" %}
4040
{% endif %}
4141

42-
<meta property="og:locale" content="{{ site.locale | default: "en" }}">
43-
<meta property="og:site_name" content="{{ site.title }}">
44-
<meta property="og:title" content="{{ page.title | default: site.title | markdownify | strip_html | strip_newlines | escape_once }}">
42+
{% if page.date %}
43+
<meta property="article:published_time" content="{{ page.date | date_to_xmlschema }}">
44+
{% endif %}
4545

4646
{% if seo_url %}
4747
<link rel="canonical" href="{{ page.url | prepend: seo_url | replace: "/index.html", "/" }}">
48-
<meta property="og:url" content="{{ page.url | prepend: seo_url | replace: "/index.html", "/" }}">
49-
{% endif %}
50-
51-
{% if page.excerpt %}
52-
<meta property="og:description" name="description" content="{{ seo_description }}">
5348
{% endif %}
5449

5550
{% if site.twitter.username %}
@@ -83,35 +78,13 @@
8378
{% endif %}
8479
{% endif %}
8580

86-
{% if page.header.image %}
87-
<meta property="og:image" content="{% if page.header.image contains "://" %}{{ page.header.image }}{% else %}{{ page.header.image | prepend: "/images/" | prepend: base_path }}{% endif %}">
88-
{% elsif page.header.overlay_image %}
89-
<meta property="og:image" content="{% if page.header.overlay_image contains "://" %}{{ page.header.overlay_image }}{% else %}{{ page.header.overlay_image | prepend: "/images/" | prepend: base_path }}{% endif %}">
90-
{% endif %}
91-
92-
{% if page.date %}
93-
<meta property="og:type" content="article">
94-
<meta property="article:published_time" content="{{ page.date | date_to_xmlschema }}">
95-
{% endif %}
96-
9781
{% if paginator.previous_page %}
9882
<link rel="prev" href="{{ paginator.previous_page_path | prepend: seo_url }}">
9983
{% endif %}
10084
{% if paginator.next_page %}
10185
<link rel="next" href="{{ paginator.next_page_path | prepend: seo_url }}">
10286
{% endif %}
10387

104-
{% if site.og_image %}
105-
<script type="application/ld+json">
106-
{
107-
"@context": "http://schema.org",
108-
"@type": "Organization",
109-
"url": {{ seo_url | jsonify }},
110-
"logo": {{ site.og_image | prepend: "/images/" | prepend: base_path | jsonify }}
111-
}
112-
</script>
113-
{% endif %}
114-
11588
{% if site.social %}
11689
<script type="application/ld+json">
11790
{
@@ -137,3 +110,37 @@
137110
<meta name="yandex-verification" content="{{ site.yandex_site_verification }}">
138111
{% endif %}
139112
<!-- end SEO -->
113+
114+
<!-- Open Graph protocol data (https://ogp.me/), used by social media -->
115+
<meta property="og:locale" content="{{ site.locale | default: "en" }}">
116+
<meta property="og:site_name" content="{{ site.title }}">
117+
<meta property="og:title" content="{{ page.title | default: site.title | markdownify | strip_html | strip_newlines | escape_once }}">
118+
{% if page.date %}
119+
<meta property="og:type" content="article">
120+
{% endif %}
121+
{% if page.excerpt %}
122+
<meta property="og:description" name="description" content="{{ seo_description }}">
123+
{% elsif site.og_description %}
124+
<meta property="og:description" name="description" content="{{ site.og_description }}">
125+
{% endif %}
126+
{% if seo_url %}
127+
<meta property="og:url" content="{{ page.url | prepend: seo_url | replace: "/index.html", "/" }}">
128+
{% endif %}
129+
130+
{% if site.og_image %}
131+
<script type="application/ld+json">
132+
{
133+
"@context": "http://schema.org",
134+
"@type": "Organization",
135+
"url": {{ seo_url | jsonify }},
136+
"logo": {{ site.og_image | prepend: "/images/" | prepend: base_path | jsonify }}
137+
}
138+
</script>
139+
{% endif %}
140+
141+
{% if page.header.image %}
142+
<meta property="og:image" content="{% if page.header.image contains "://" %}{{ page.header.image }}{% else %}{{ page.header.image | prepend: "/images/" | prepend: base_path }}{% endif %}">
143+
{% elsif page.header.overlay_image %}
144+
<meta property="og:image" content="{% if page.header.overlay_image contains "://" %}{{ page.header.overlay_image }}{% else %}{{ page.header.overlay_image | prepend: "/images/" | prepend: base_path }}{% endif %}">
145+
{% endif %}
146+
<!-- end Open Graph protocol -->

0 commit comments

Comments
 (0)