Skip to content

Commit 38d2df6

Browse files
authored
Merge pull request creativecommons#212 from techievivek/description-for-meta-tags
added description content for meta description
2 parents fea1b59 + cb2f5d4 commit 38d2df6

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

.lektorproject

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@ lektor-google-analytics = 0.1.3
1212
lektor-webpack-support = 0.5
1313
lektor-atom = 0.3
1414
lektor-disqus-comments = 0.4.1
15+
lektor-strip-html-tags = 0.3.1
16+
lektor-markdown-excerpt = 0.1

templates/layout.html

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,15 @@
77
<link rel="stylesheet" href="{{ '/static/gen/style.css'|url }}">
88
<meta property="og:site_name" content="Creative Commons" />
99
<meta property="og:title" content="{{ this.title }}" />
10-
<meta property="og:description" content="" />
10+
{% if this.description %}
11+
{% set desc = this.description|excerpt|striphtmltags %}
12+
<meta property="og:description" content="{{ desc }}" />
13+
{% else %}
14+
{% if this.body %}
15+
{% set desc = this.body|excerpt|striphtmltags %}
16+
<meta property="og:description" content="{{ desc }}" />
17+
{% endif %}
18+
{% endif %}
1119
<meta property="og:url" content="{{ this|url }}" />
1220
<meta property="og:type" content="article" />
1321
{% set image = this.attachments.images.first() %}
@@ -16,7 +24,7 @@
1624
{% endif %}
1725
<meta name="twitter:card" content="summary_large_image" />
1826
<meta name="twitter:title" content="{{ this.title }}">
19-
<meta name="twitter:description" content="">
27+
<meta name="twitter:description" content="{{ desc }}">
2028
{% if image %}
2129
<meta name="twitter:image" content="{{ image|url(external=true) }}">
2230
{% endif %}

0 commit comments

Comments
 (0)