eleventy-plugin-podcaster 0.9.2 → 0.9.4
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/README.md +0 -1
- package/docs/episode-information.md +1 -0
- package/docs/optional-features.md +8 -1
- package/docs/podcast-information.md +23 -2
- package/eleventy.config.js +10 -8
- package/package.json +1 -1
- package/src/podcastFeed.njk +24 -12
package/README.md
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
`eleventy-plugin-podcaster` — or **Podcaster**, as we will call it from now on — lets you use Eleventy to create a podcast and its accompanying website. **Podcaster** creates the podcast feed that you submit to Apple Podcasts, Spotify or any other podcast directory. And it provides information about your podcast to your Eleventy templates. This means that you can include information about the podcast and its episodes on your podcast's website, creating pages for individual episodes, guests, topics, seasons or anything else at all.
|
|
4
4
|
|
|
5
|
-
|
|
6
5
|
## Installation
|
|
7
6
|
|
|
8
7
|
To install the npm package, type this at the command line:
|
|
@@ -36,6 +36,7 @@ Here's a detailed description of the data you need to provide here.
|
|
|
36
36
|
| `title` | The title of the episode; this will also be the title of the post on the website. | yes |
|
|
37
37
|
| `date` | The release date of the episode; this will also be the date of the post on the website | yes |
|
|
38
38
|
| `tags` | Every episode post must have the tag `podcastEpisode` included in the `tags` array. Other tags are also permitted. | yes |
|
|
39
|
+
| `guid` | A unique ID for the post. Normally this will be the post's URL, in which case there is no need to provide it here. It's should really only be necessary to provide it if you're importing the podcast from some other system that has assigned a guid to each post. | no |
|
|
39
40
|
| `episode.filename` | The filename of the episode's audio file. | yes |
|
|
40
41
|
| `episode.seasonNumber` | The season number. (Most podcasts don't group their episodes into seasons.) | no |
|
|
41
42
|
| `episode.episodeNumber` | The episode number. Needn't be unique, but the combination of `seasonNumber` and `episodeNumber` must be unique. | yes |
|
|
@@ -12,7 +12,8 @@ export default function (eleventyConfig) {
|
|
|
12
12
|
.
|
|
13
13
|
eleventyConfig.addPlugin(podcasterPlugin, {
|
|
14
14
|
handleDrafts: true,
|
|
15
|
-
handleExcerpts: true
|
|
15
|
+
handleExcerpts: true,
|
|
16
|
+
readableDateLocale: 'en-GB'
|
|
16
17
|
})
|
|
17
18
|
.
|
|
18
19
|
.
|
|
@@ -34,3 +35,9 @@ Excerpts are available in a template as `{{ excerpt }}`, but you will probably a
|
|
|
34
35
|
1. As an `excerpt` field in the post's front matter. This should be written in Markdown.
|
|
35
36
|
2. The part of the post between the excerpt delimiters `<!---excerpt-->` and `<!---endexcerpt-->` .
|
|
36
37
|
3. The first paragraph in the post which is not nested inside another tag. (This is so that a blockquote at the beginning of a post isn't included in the excerpt.)
|
|
38
|
+
|
|
39
|
+
## `readableDate` filter
|
|
40
|
+
|
|
41
|
+
**Podcaster** optionally provides a `readableDate` filter, to match `readableDuration` and `readableSize`. It transforms a date into a localised string, which usually includes weekday, day of month, month and year.
|
|
42
|
+
|
|
43
|
+
To make **Podcaster** provide this filter, pass a locale string as one of the options when you're adding the plugin to your config file. In English, the two most common locale strings are `'en-GB'` and `'en-US'`.
|
|
@@ -42,6 +42,7 @@ However, `eleventy-plugin-podcast` is quite customisable. He's another `podcast.
|
|
|
42
42
|
"episodeUrlBase": "https://example.fte-cdn.com/",
|
|
43
43
|
"feedEpisodeContentTemplate": "feed-episode-content.njk",
|
|
44
44
|
"feedEpisodeDescriptionTemplate": "feed-episode-description.njk"
|
|
45
|
+
"feedEpisodeSummaryTemplate": "feed-episode-summary.njk"
|
|
45
46
|
}
|
|
46
47
|
```
|
|
47
48
|
|
|
@@ -67,8 +68,28 @@ And here's a detailed description of all of this information.
|
|
|
67
68
|
| `copyright` | The copyright owner of the podcast. If omitted, the value supplied for `author` is used instead. | no |
|
|
68
69
|
| `startingYear` | The year your podcast started. Used to express the copyright date as a range (_"© 2014–2024 Flight Through Entirety"_). If this is omitted, the copyright date will just be the current year. | no |
|
|
69
70
|
| `episodeUrlBase` | If you store your podcast episodes on a CDN, or if you use a podcast analytics service, this is where you specify the base URL for them. If you don't specify this, it defaults to `https://{{ podcast.siteUrl }}/episodes/` | no |
|
|
70
|
-
| `feedEpisodeContentTemplate` | The name of an include template that will be used to create the show notes of each episode, as displayed in your listeners' podcast players. The content of this template should be HTML. You only need to include this if you want the show notes in podcast players to be different from the show notes on the website. | no |
|
|
71
|
-
| `feedEpisodeDescriptionTemplate` | The name of an include template that will be used to create the description of each episode. The content of this template should be plain text. If it's omitted, the description will just be an abbreviated text version of the `content` of the episode's post. | no |
|
|
72
71
|
|
|
73
72
|
[categories]: https://podcasters.apple.com/support/1691-apple-podcasts-categories
|
|
74
73
|
[lang]: https://www.rssboard.org/rss-language-codes
|
|
74
|
+
|
|
75
|
+
## Feed episode templates
|
|
76
|
+
|
|
77
|
+
For each episode of the podcast, the feed can contain three textual descriptions — `content`, `description` and `summary`. `content` is HTML and will contain the show notes of an episode. `description` and `summary` are short plain text descriptions of the episode.
|
|
78
|
+
|
|
79
|
+
By default, **Podcaster** will set the `content` of the feed to the `content` of an episode's post, and will set `summary` and `description` to an abbreviated version of the content (roughly the first 500 characters of the `content`). And this will be perfectly fine for most podcast feeds.
|
|
80
|
+
|
|
81
|
+
However, if you want to, you can override any or all of these three textual descriptions by providing special templates in the includes directory and adding their names to the `podcast` object.
|
|
82
|
+
|
|
83
|
+
| field | value | required? |
|
|
84
|
+
| ----- | ----- | --------- |
|
|
85
|
+
| `feedEpisodeContentTemplate` | The name of an include template that will be used to create the show notes of each episode, as displayed in your listeners' podcast players. The content of this template should be HTML. You only need to include this if you want the show notes in podcast players to be different from the show notes on the website. | no |
|
|
86
|
+
| `feedEpisodeDescriptionTemplate` | The name of an include template that will be used to create the description of each episode. The content of this template should be plain text. If it's omitted, the description will just be an abbreviated text version of the `content` of the episode's post. | no |
|
|
87
|
+
| `feedEpisodeSummaryTemplate` | The name of an include template that will be used to create the summary of each episode. The content of this template should be plain text. If it's omitted, the description will just be an abbreviated text version of the `content` of the episode's post. | no |
|
|
88
|
+
|
|
89
|
+
These templates must be Nunjucks templates, and the post for the episode must be referred to by the variable `post`. Here's a sample content template from one of my podcast websites.
|
|
90
|
+
|
|
91
|
+
```njk
|
|
92
|
+
<p class="diary-date">{{ post.data.diaryDate | readableDate }}</p>
|
|
93
|
+
<p class="topic">{{ post.data.topic }}</p>
|
|
94
|
+
{{ post.content | safe }}
|
|
95
|
+
```
|
package/eleventy.config.js
CHANGED
|
@@ -56,15 +56,17 @@ export default function (eleventyConfig, options = {}) {
|
|
|
56
56
|
|
|
57
57
|
eleventyConfig.addShortcode('year', () => DateTime.now().year)
|
|
58
58
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
date
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
59
|
+
if (options.readableDateLocale) {
|
|
60
|
+
eleventyConfig.addFilter('readableDate', function (date) {
|
|
61
|
+
if (date instanceof Date) {
|
|
62
|
+
date = date.toISOString()
|
|
63
|
+
}
|
|
64
|
+
const result = DateTime.fromISO(date, {
|
|
65
|
+
zone: 'UTC'
|
|
66
|
+
})
|
|
67
|
+
return result.setLocale(options.readableDateLocale).toLocaleString(DateTime.DATE_HUGE)
|
|
65
68
|
})
|
|
66
|
-
|
|
67
|
-
})
|
|
69
|
+
}
|
|
68
70
|
|
|
69
71
|
eleventyConfig.addFilter('readableDuration', function (seconds) {
|
|
70
72
|
if (!seconds) return '0:00:00'
|
package/package.json
CHANGED
package/src/podcastFeed.njk
CHANGED
|
@@ -29,7 +29,7 @@ eleventyAllowMissingExtension: true
|
|
|
29
29
|
{%- else %}
|
|
30
30
|
<itunes:category text="{{ podcast.category }}" />
|
|
31
31
|
{%- endif %}
|
|
32
|
-
<itunes:image href="{{ podcast.imagePath | htmlBaseUrl(
|
|
32
|
+
<itunes:image href="{{ podcast.imagePath | htmlBaseUrl(siteUrl) }}"></itunes:image>
|
|
33
33
|
<itunes:summary>{{ podcast.summary or podcast.description }}</itunes:summary>
|
|
34
34
|
{% if podcast.explicit !== undefined %}<itunes:explicit>{{ podcast.explicit or "false" }}</itunes:explicit>{% endif -%}
|
|
35
35
|
{%- if podcast.type %}
|
|
@@ -46,32 +46,44 @@ eleventyAllowMissingExtension: true
|
|
|
46
46
|
{% for post in collections.podcastEpisode | reverse %}
|
|
47
47
|
<item>
|
|
48
48
|
<title>{{ post.data.title }}</title>
|
|
49
|
-
<link>{{ post.url | htmlBaseUrl(
|
|
49
|
+
<link>{{ post.url | htmlBaseUrl(siteUrl) }}</link>
|
|
50
50
|
<pubDate>{{ post.date | dateToRfc3339 }}</pubDate>
|
|
51
51
|
{% if post.data.episode.seasonNumber -%}
|
|
52
52
|
<itunes:season>{{ post.data.episode.seasonNumber }}</itunes:season>
|
|
53
53
|
{%- endif %}
|
|
54
54
|
<itunes:episode>{{ post.data.episode.episodeNumber }}</itunes:episode>
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
{% if podcast.feedEpisodeSummaryTemplate %}
|
|
56
|
+
{%- set episodeSummary -%}
|
|
57
|
+
{% include podcast.feedEpisodeSummaryTemplate %}
|
|
58
|
+
{%- endset -%}
|
|
59
|
+
{% else %}
|
|
60
|
+
{%- set episodeSummary = post.content | striptags(true) | truncate(500) -%}
|
|
61
|
+
{%- endif %}
|
|
62
|
+
<itunes:summary>{{ episodeSummary }}</itunes:summary>
|
|
63
|
+
{% if podcast.feedEpisodeDescriptionTemplate %}
|
|
64
|
+
{%- set episodeDescription -%}
|
|
65
|
+
{% include podcast.feedEpisodeDescriptionTemplate %}
|
|
66
|
+
{%- endset -%}
|
|
67
|
+
{% else %}
|
|
68
|
+
{%- set episodeDescription = post.content | striptags(true) | truncate(800) -%}
|
|
69
|
+
{%- endif %}
|
|
70
|
+
<description>{{ episodeDescription }}</description>
|
|
57
71
|
{% if podcast.feedEpisodeContentTemplate %}
|
|
58
72
|
{%- set episodeContent -%}
|
|
59
73
|
{% include podcast.feedEpisodeContentTemplate %}
|
|
60
74
|
{%- endset -%}
|
|
75
|
+
{% else %}
|
|
76
|
+
{%- set episodeContent = post.content -%}
|
|
77
|
+
{% endif %}
|
|
61
78
|
<content:encoded>
|
|
62
|
-
<![CDATA[{{ episodeContent | renderTransforms(post.data.page,
|
|
63
|
-
</content:encoded>
|
|
64
|
-
{%- else -%}
|
|
65
|
-
<content:encoded>
|
|
66
|
-
<![CDATA[{{ post.content | renderTransforms(post.data.page, podcast.siteUrl) | safe | trim }}]]>
|
|
79
|
+
<![CDATA[{{ episodeContent | renderTransforms(post.data.page, siteUrl) | safe | trim }}]]>
|
|
67
80
|
</content:encoded>
|
|
68
|
-
{% endif %}
|
|
69
81
|
<enclosure url="{{ post.data.episode.url }}" length="{{ post.data.episode.size }}" type="audio/mp3"></enclosure>
|
|
70
82
|
<itunes:duration>{{ post.data.episode.duration | readableDuration }}</itunes:duration>
|
|
71
83
|
{%- if post.data.guid != undefined %}
|
|
72
|
-
<guid isPermalink="false">{{ post.data.
|
|
84
|
+
<guid isPermalink="false">{{ post.data.guid }}</guid>
|
|
73
85
|
{% else %}
|
|
74
|
-
<guid isPermalink="true">{{ post.url | htmlBaseUrl(
|
|
86
|
+
<guid isPermalink="true">{{ post.url | htmlBaseUrl(siteUrl) }}</guid>
|
|
75
87
|
{% endif -%}
|
|
76
88
|
{%- if post.data.explicit != undefined %}
|
|
77
89
|
<itunes:explicit>{{ post.data.explicit }}</itunes:explicit>
|