eleventy-plugin-podcaster 0.10.1 → 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 +1 -1
- package/src/excerpts.js +1 -2
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
package/src/excerpts.js
CHANGED
|
@@ -23,7 +23,7 @@ export default function (eleventyConfig, options = {}) {
|
|
|
23
23
|
const contentIsMarkdown = data.page.templateSyntax.includes('md')
|
|
24
24
|
|
|
25
25
|
// If an excerpt is set using comment delimiters, use it
|
|
26
|
-
const excerptPattern = /<!---excerpt-->\s*(.*?)\s*<!---endexcerpt-->/
|
|
26
|
+
const excerptPattern = /<!---excerpt-->\s*(.*?)\s*<!---endexcerpt-->/s
|
|
27
27
|
const match = excerptPattern.exec(content)
|
|
28
28
|
if (match && contentIsMarkdown) {
|
|
29
29
|
return md.render(match[1])
|
|
@@ -40,7 +40,6 @@ export default function (eleventyConfig, options = {}) {
|
|
|
40
40
|
const paragraph = dom.children.find(item => item.type === 'tag' && item.name === 'p')
|
|
41
41
|
if (paragraph) {
|
|
42
42
|
const result = render(paragraph, { encodeEntities: 'utf8' })
|
|
43
|
-
console.log(result)
|
|
44
43
|
return result
|
|
45
44
|
}
|
|
46
45
|
}
|