Skip to content

Commit 24fd7e7

Browse files
authored
resolves #117 add OpenGraph and Twitter Card meta to documentation pages (PR #120)
1 parent 4df337f commit 24fd7e7

File tree

3 files changed

+21
-8
lines changed

3 files changed

+21
-8
lines changed

src/img/asciidoctor-og.png

314 KB
Loading

src/partials/head-info.hbs

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,28 @@
1+
{{#with (or antoraVersion site.antoraVersion)}}
2+
<meta name="generator" content="Antora {{this}}">
3+
{{/with}}
14
{{#with page.canonicalUrl}}
25
<link rel="canonical" href="{{{this}}}">
6+
<meta property="og:url" content="{{{this}}}">
37
{{/with}}
8+
{{#with page.description}}
9+
<meta name="description" content="{{{detag this}}}">
10+
<meta property="og:description" content="{{{detag this}}}">
11+
{{else}}
412
{{#if page.component}}
5-
<meta name="page-spec" content="{{spec page}}">
13+
<meta property="og:description" content="A documentation page for {{{page.component.title}}}.">
614
{{/if}}
7-
{{#with page.description}}
8-
<meta name="description" content="{{this}}">
915
{{/with}}
1016
{{#with page.keywords}}
11-
<meta name="keywords" content="{{this}}">
12-
{{/with}}
13-
{{#with (or antoraVersion site.antoraVersion)}}
14-
<meta name="generator" content="Antora {{this}}">
17+
<meta name="keywords" content="{{{this}}}">
1518
{{/with}}
19+
{{#if page.component}}
20+
<meta property="og:site_name" content="Asciidoctor Docs">
21+
<meta name="twitter:card" content="summary_large_image">
22+
<meta property="og:title" content="{{{detag page.title}}}">
23+
<meta property="og:image" content="{{{or site.url siteRootPath}}}/_/img/asciidoctor-og.png">
24+
<meta name="twitter:site" content="@asciidoctor">
25+
{{/if}}
1626
{{#unless (eq page.attributes.pagination undefined)}}
1727
{{#with page.previous}}
1828
<link rel="prev" href="{{{relativize ./url}}}">
@@ -21,3 +31,6 @@
2131
<link rel="next" href="{{{relativize ./url}}}">
2232
{{/with}}
2333
{{/unless}}
34+
{{#if page.component}}
35+
<meta name="page-spec" content="{{{spec page}}}">
36+
{{/if}}

src/partials/head.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{{> head-prelude}}
22
{{> head-title}}
3-
{{> head-info}}
43
{{> head-styles}}
4+
{{> head-info}}
55
{{> head-meta}}
66
{{> head-scripts}}
77
{{> head-icons}}

0 commit comments

Comments
 (0)