eleventy-plugin-podcaster 0.10.0 → 0.10.2
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/eleventy.config.js +15 -0
- package/package.json +2 -2
- package/src/excerpts.js +7 -3
package/eleventy.config.js
CHANGED
|
@@ -68,6 +68,21 @@ export default function (eleventyConfig, options = {}) {
|
|
|
68
68
|
})
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
+
if (options.calculatePageTitle) {
|
|
72
|
+
const separator = options.calculatePageTitle === true ? '·' : options.calculatePageTitle
|
|
73
|
+
|
|
74
|
+
eleventyConfig.addGlobalData('eleventyComputed.pageTitle', () => {
|
|
75
|
+
return data => {
|
|
76
|
+
const siteTitle = data.site?.title || data.podcast.title
|
|
77
|
+
if (data.title && data.title.length > 0 && data.title !== siteTitle) {
|
|
78
|
+
return `${data.title} ${separator} ${siteTitle}`
|
|
79
|
+
} else {
|
|
80
|
+
return siteTitle
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
})
|
|
84
|
+
}
|
|
85
|
+
|
|
71
86
|
eleventyConfig.addFilter('readableDuration', function (seconds) {
|
|
72
87
|
if (!seconds) return '0:00:00'
|
|
73
88
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eleventy-plugin-podcaster",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.2",
|
|
4
4
|
"description": "An Eleventy plugin that allows you to create a podcast and its accompanying website",
|
|
5
5
|
"main": "eleventy.config.js",
|
|
6
6
|
"exports": {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
},
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
11
|
-
"url": "https://github.com/nathan-bottomley/eleventy-plugin-podcaster.git"
|
|
11
|
+
"url": "git+https://github.com/nathan-bottomley/eleventy-plugin-podcaster.git"
|
|
12
12
|
},
|
|
13
13
|
"homepage": "https://github.com/nathan-bottomley/eleventy-plugin-podcaster/tree/main/docs",
|
|
14
14
|
"type": "module",
|
package/src/excerpts.js
CHANGED
|
@@ -9,7 +9,10 @@ export default function (eleventyConfig, options = {}) {
|
|
|
9
9
|
return (data) => {
|
|
10
10
|
if (!data.tags?.includes('podcastEpisode')) return
|
|
11
11
|
|
|
12
|
-
const md = markdownIt(
|
|
12
|
+
const md = markdownIt({
|
|
13
|
+
html: true,
|
|
14
|
+
typographer: true
|
|
15
|
+
})
|
|
13
16
|
|
|
14
17
|
// If an excerpt is set in front matter, use it
|
|
15
18
|
if (data.excerpt) {
|
|
@@ -20,7 +23,7 @@ export default function (eleventyConfig, options = {}) {
|
|
|
20
23
|
const contentIsMarkdown = data.page.templateSyntax.includes('md')
|
|
21
24
|
|
|
22
25
|
// If an excerpt is set using comment delimiters, use it
|
|
23
|
-
const excerptPattern = /<!---excerpt-->\s*(.*?)\s*<!---endexcerpt-->/
|
|
26
|
+
const excerptPattern = /<!---excerpt-->\s*(.*?)\s*<!---endexcerpt-->/s
|
|
24
27
|
const match = excerptPattern.exec(content)
|
|
25
28
|
if (match && contentIsMarkdown) {
|
|
26
29
|
return md.render(match[1])
|
|
@@ -36,7 +39,8 @@ export default function (eleventyConfig, options = {}) {
|
|
|
36
39
|
const dom = htmlparser2.parseDocument(htmlContent)
|
|
37
40
|
const paragraph = dom.children.find(item => item.type === 'tag' && item.name === 'p')
|
|
38
41
|
if (paragraph) {
|
|
39
|
-
|
|
42
|
+
const result = render(paragraph, { encodeEntities: 'utf8' })
|
|
43
|
+
return result
|
|
40
44
|
}
|
|
41
45
|
}
|
|
42
46
|
})
|