Skip to content

Commit 4f4fc3e

Browse files
committed
meta update
1 parent d1edefa commit 4f4fc3e

File tree

2 files changed

+131
-11
lines changed

2 files changed

+131
-11
lines changed

blog/_includes/meta.html

Lines changed: 130 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,144 @@
22
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
33
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0'>
44

5+
<!-- SEO Meta Tags -->
6+
<meta name="author" content="{{ site.name }}" />
7+
<meta name="robots" content="index, follow" />
8+
<meta name="language" content="en" />
9+
510
{% if page.excerpt %}
6-
<meta property="og:description" content="{{ page.excerpt| strip_html }}" />
7-
{% else if page.description %}
8-
<meta property="og:description" content="{{ page.description }}" />
11+
<meta name="description" content="{{ page.excerpt | strip_html | strip_newlines | truncate: 160 }}" />
12+
{% elsif page.description %}
13+
<meta name="description" content="{{ page.description | strip_html | strip_newlines | truncate: 160 }}" />
914
{% else %}
10-
<meta property="og:description" content="{{ site.description }}" />
15+
<meta name="description" content="{{ site.description | strip_html | strip_newlines | truncate: 160 }}" />
16+
{% endif %}
17+
18+
{% if page.tags %}
19+
<meta name="keywords" content="{{ page.tags | join: ', ' }}" />
1120
{% endif %}
12-
<meta name="author" content="{{ site.name }}" />
21+
22+
<!-- Open Graph Meta Tags -->
23+
<meta property="og:type" content="{% if page.layout == 'post' %}article{% else %}website{% endif %}" />
24+
<meta property="og:site_name" content="{{ site.name }}" />
25+
<meta property="og:url" content="{{ site.url }}{{ site.baseurl }}{{ page.url }}" />
1326

1427
{% if page.title %}
1528
<meta property="og:title" content="{{ page.title }}" />
16-
<meta property="twitter:title" content="{{ page.title }}" />
29+
{% else %}
30+
<meta property="og:title" content="{{ site.name }}" />
31+
{% endif %}
32+
33+
{% if page.excerpt %}
34+
<meta property="og:description" content="{{ page.excerpt | strip_html | strip_newlines | truncate: 300 }}" />
35+
{% elsif page.description %}
36+
<meta property="og:description" content="{{ page.description | strip_html | strip_newlines | truncate: 300 }}" />
37+
{% else %}
38+
<meta property="og:description" content="{{ site.description | strip_html | strip_newlines | truncate: 300 }}" />
39+
{% endif %}
40+
41+
{% if page.image %}
42+
<meta property="og:image" content="{{ site.url }}{{ site.baseurl }}{{ page.image }}" />
43+
<meta property="og:image:alt" content="{% if page.image_alt %}{{ page.image_alt }}{% else %}{{ page.title | default: site.name }}{% endif %}" />
44+
{% else %}
45+
<meta property="og:image" content="{{ site.url }}{{ site.baseurl }}/images/sm-image.jpg" />
46+
<meta property="og:image:alt" content="{{ site.name }} - {{ site.description }}" />
47+
{% endif %}
48+
49+
<meta property="og:image:width" content="1200" />
50+
<meta property="og:image:height" content="630" />
51+
52+
{% if page.layout == 'post' %}
53+
<meta property="article:author" content="{{ site.name }}" />
54+
<meta property="article:published_time" content="{{ page.date | date_to_xmlschema }}" />
55+
{% if page.modified_date %}
56+
<meta property="article:modified_time" content="{{ page.modified_date | date_to_xmlschema }}" />
57+
{% endif %}
58+
{% if page.categories %}
59+
{% for category in page.categories %}
60+
<meta property="article:section" content="{{ category }}" />
61+
{% endfor %}
62+
{% endif %}
63+
{% if page.tags %}
64+
{% for tag in page.tags %}
65+
<meta property="article:tag" content="{{ tag }}" />
66+
{% endfor %}
67+
{% endif %}
68+
{% endif %}
69+
70+
<!-- Twitter Card Meta Tags -->
71+
<meta name="twitter:card" content="summary_large_image" />
72+
<meta name="twitter:site" content="@{{ site.footer-links.twitter }}" />
73+
<meta name="twitter:creator" content="@{{ site.footer-links.twitter }}" />
74+
75+
{% if page.title %}
76+
<meta name="twitter:title" content="{{ page.title }}" />
77+
{% else %}
78+
<meta name="twitter:title" content="{{ site.name }}" />
79+
{% endif %}
80+
81+
{% if page.excerpt %}
82+
<meta name="twitter:description" content="{{ page.excerpt | strip_html | strip_newlines | truncate: 200 }}" />
83+
{% elsif page.description %}
84+
<meta name="twitter:description" content="{{ page.description | strip_html | strip_newlines | truncate: 200 }}" />
85+
{% else %}
86+
<meta name="twitter:description" content="{{ site.description | strip_html | strip_newlines | truncate: 200 }}" />
1787
{% endif %}
1888

1989
{% if page.image %}
20-
<meta property="og:image" content="{{ site.url }}{{ page.image }}"/>
21-
<meta property="twitter:image" content="{{ site.url }}{{ page.image }}"/>
90+
<meta name="twitter:image" content="{{ site.url }}{{ site.baseurl }}{{ page.image }}" />
91+
<meta name="twitter:image:alt" content="{% if page.image_alt %}{{ page.image_alt }}{% else %}{{ page.title | default: site.name }}{% endif %}" />
2292
{% else %}
23-
<meta property="og:image" content="{{ site.url }}{{ site.avatar }}"/>
24-
<meta property="twitter:image" content="{{ site.url }}{{ site.avatar }}"/>
93+
<meta name="twitter:image" content="{{ site.url }}{{ site.baseurl }}/images/sm-image.jpg" />
94+
<meta name="twitter:image:alt" content="{{ site.name }} - {{ site.description }}" />
2595
{% endif %}
96+
97+
<!-- Additional SEO Meta Tags -->
98+
<link rel="canonical" href="{{ site.url }}{{ site.baseurl }}{{ page.url }}" />
99+
100+
{% if page.layout == 'post' %}
101+
<meta name="article:author" content="{{ site.name }}" />
102+
<meta name="publish_date" property="og:publish_date" content="{{ page.date | date_to_xmlschema }}" />
103+
{% endif %}
104+
105+
<!-- Schema.org structured data -->
106+
<script type="application/ld+json">
107+
{
108+
"@context": "https://schema.org",
109+
"@type": "{% if page.layout == 'post' %}BlogPosting{% else %}WebSite{% endif %}",
110+
"headline": "{% if page.title %}{{ page.title | jsonify }}{% else %}{{ site.name | jsonify }}{% endif %}",
111+
"description": "{% if page.excerpt %}{{ page.excerpt | strip_html | strip_newlines | truncate: 300 | jsonify }}{% elsif page.description %}{{ page.description | strip_html | strip_newlines | truncate: 300 | jsonify }}{% else %}{{ site.description | strip_html | strip_newlines | truncate: 300 | jsonify }}{% endif %}",
112+
"url": "{{ site.url }}{{ site.baseurl }}{{ page.url }}",
113+
{% if page.image %}
114+
"image": "{{ site.url }}{{ site.baseurl }}{{ page.image }}",
115+
{% else %}
116+
"image": "{{ site.url }}{{ site.baseurl }}/images/sm-image.jpg",
117+
{% endif %}
118+
{% if page.layout == 'post' %}
119+
"datePublished": "{{ page.date | date_to_xmlschema }}",
120+
{% if page.modified_date %}
121+
"dateModified": "{{ page.modified_date | date_to_xmlschema }}",
122+
{% else %}
123+
"dateModified": "{{ page.date | date_to_xmlschema }}",
124+
{% endif %}
125+
"author": {
126+
"@type": "Organization",
127+
"name": "{{ site.name }}",
128+
"url": "{{ site.url }}{{ site.baseurl }}"
129+
},
130+
"publisher": {
131+
"@type": "Organization",
132+
"name": "{{ site.name }}",
133+
"url": "{{ site.url }}{{ site.baseurl }}",
134+
"logo": {
135+
"@type": "ImageObject",
136+
"url": "{{ site.url }}{{ site.baseurl }}{{ site.avatar }}"
137+
}
138+
},
139+
{% endif %}
140+
"mainEntityOfPage": {
141+
"@type": "WebPage",
142+
"@id": "{{ site.url }}{{ site.baseurl }}{{ page.url }}"
143+
}
144+
}
145+
</script>

blog/_layouts/default.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<link rel="stylesheet" type="text/css" href="{{ site.baseurl }}/assets/style.css" />
99
<link rel="alternate" type="application/rss+xml" title="{{ site.name }} - {{ site.description }}" href="{{ site.baseurl }}/feed.xml" />
10-
<link rel="canonical" href="{{ site.url }}{{ page.url }}" />
10+
1111

1212
<meta name="theme-color" content="#000000">
1313
<link rel="icon" type="image/png" sizes="32x32" href="{{ site.baseurl }}/images/favicon-32x32.png">

0 commit comments

Comments
 (0)