mdorigin 0.5.4 → 0.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/html/template.js +28 -10
- package/package.json +1 -1
package/dist/html/template.js
CHANGED
|
@@ -8,23 +8,41 @@ export function renderDocument(options) {
|
|
|
8
8
|
const siteDescription = options.siteDescription
|
|
9
9
|
? escapeHtml(options.siteDescription)
|
|
10
10
|
: undefined;
|
|
11
|
+
const socialDescription = options.summary ?? options.siteDescription;
|
|
11
12
|
const summaryMeta = options.summary
|
|
12
13
|
? `<meta name="description" content="${escapeHtml(options.summary)}">`
|
|
13
14
|
: '';
|
|
14
|
-
const
|
|
15
|
-
?
|
|
15
|
+
const canonicalUrl = options.siteUrl && options.canonicalPath
|
|
16
|
+
? `${options.siteUrl}${options.canonicalPath}`
|
|
17
|
+
: undefined;
|
|
18
|
+
const canonicalMeta = canonicalUrl
|
|
19
|
+
? `<link rel="canonical" href="${escapeHtml(canonicalUrl)}">`
|
|
16
20
|
: '';
|
|
17
21
|
const faviconMeta = options.favicon
|
|
18
22
|
? `<link rel="icon" href="${escapeHtml(options.favicon)}">`
|
|
19
23
|
: '';
|
|
20
24
|
const absoluteSocialImageUrl = getAbsoluteSiteAssetUrl(options.siteUrl, options.socialImage);
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
const socialMeta = [
|
|
26
|
+
`<meta property="og:title" content="${title}">`,
|
|
27
|
+
socialDescription
|
|
28
|
+
? `<meta property="og:description" content="${escapeHtml(socialDescription)}">`
|
|
29
|
+
: '',
|
|
30
|
+
canonicalUrl
|
|
31
|
+
? `<meta property="og:url" content="${escapeHtml(canonicalUrl)}">`
|
|
32
|
+
: '',
|
|
33
|
+
'<meta property="og:type" content="website">',
|
|
34
|
+
`<meta name="twitter:title" content="${title}">`,
|
|
35
|
+
socialDescription
|
|
36
|
+
? `<meta name="twitter:description" content="${escapeHtml(socialDescription)}">`
|
|
37
|
+
: '',
|
|
38
|
+
absoluteSocialImageUrl
|
|
39
|
+
? [
|
|
40
|
+
`<meta property="og:image" content="${escapeHtml(absoluteSocialImageUrl)}">`,
|
|
41
|
+
'<meta name="twitter:card" content="summary_large_image">',
|
|
42
|
+
`<meta name="twitter:image" content="${escapeHtml(absoluteSocialImageUrl)}">`,
|
|
43
|
+
].join('')
|
|
44
|
+
: '',
|
|
45
|
+
].join('');
|
|
28
46
|
const alternateMarkdownMeta = options.alternateMarkdownPath
|
|
29
47
|
? `<link rel="alternate" type="text/markdown" href="${escapeHtml(options.alternateMarkdownPath)}">`
|
|
30
48
|
: '';
|
|
@@ -133,7 +151,7 @@ export function renderDocument(options) {
|
|
|
133
151
|
summaryMeta,
|
|
134
152
|
canonicalMeta,
|
|
135
153
|
faviconMeta,
|
|
136
|
-
|
|
154
|
+
socialMeta,
|
|
137
155
|
alternateMarkdownMeta,
|
|
138
156
|
rssMeta,
|
|
139
157
|
hreflangMeta,
|