Skip to content

Commit a9c14ab

Browse files
Fix unwanted newlines and added generic <meta> tag (#17)
1 parent 2a2f15f commit a9c14ab

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

_includes/head.html

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,24 @@
1818
<meta property="og:image" content="{{ "/img/social-preview.jpg" | prepend: site.url }}" />
1919
<meta name="twitter:image" content="{{ "/img/social-preview.jpg" | prepend: site.url }}" />
2020
{% endif %}
21-
<meta name="og:description" content="{% if page.description %}
22-
{{ page.description | strip_html | strip_newlines | truncate: 160 }}
23-
{% else %}
24-
{{ site.description }}
25-
{% endif %}">
21+
22+
<!-- html_description is a Jekyll variable,
23+
the "-" dashes tell Jekyll to ignore whitespace -->
24+
{%- capture html_description -%}
25+
{%- if page.description -%}
26+
{{- page.description | strip_html | strip_newlines | truncate: 160 -}}
27+
{%- else -%}
28+
{{- site.description -}}
29+
{%- endif -%}
30+
{%- endcapture %}
31+
<meta name="og:description" content="{{ html_description }}">
32+
<!-- temp separator -->
2633
<meta property="og:locale" content="en_US" />
2734
<meta name="twitter:card" content="summary_large_image">
2835
<meta name="twitter:domain" content="natrongithub.github.io">
2936
<meta name="twitter:title" content="{{page.title}}">
30-
<meta name="twitter:description" content="{% if page.description %}
31-
{{ page.description | strip_html | strip_newlines | truncate: 160 }}
32-
{% else %}
33-
{{ site.description }}
34-
{% endif %}">
37+
<meta name="twitter:description" content="{{ html_description }}">
38+
<meta name="description" content="{{ html_description }}">
3539
<!-- RSS Feed -->
3640
<link rel="alternate" type="application/rss+xml" href="{% base %}feed.atom">
3741

0 commit comments

Comments
 (0)