eleventy-plugin-podcaster 0.9.3 → 0.9.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/README.md +2 -2
- package/docs/README.md +3 -3
- package/docs/episode-information.md +1 -0
- package/docs/optional-features.md +4 -4
- package/docs/podcast-information.md +25 -2
- package/docs/size-and-duration.md +5 -5
- package/package.json +1 -1
- package/src/drafts.js +2 -2
- package/src/podcastFeed.njk +17 -9
package/README.md
CHANGED
|
@@ -15,12 +15,12 @@ And then include the plugin in your Eleventy configuration file.
|
|
|
15
15
|
```js
|
|
16
16
|
// eleventy.config.js
|
|
17
17
|
|
|
18
|
-
import
|
|
18
|
+
import Podcaster from 'eleventy-plugin-podcaster'
|
|
19
19
|
|
|
20
20
|
export default function (eleventyConfig) {
|
|
21
21
|
.
|
|
22
22
|
.
|
|
23
|
-
eleventyConfig.addPlugin(
|
|
23
|
+
eleventyConfig.addPlugin(Podcaster)
|
|
24
24
|
.
|
|
25
25
|
.
|
|
26
26
|
}
|
package/docs/README.md
CHANGED
|
@@ -25,12 +25,12 @@ And then include the plugin in your Eleventy configuration file.
|
|
|
25
25
|
```js
|
|
26
26
|
// eleventy.config.js
|
|
27
27
|
|
|
28
|
-
import
|
|
28
|
+
import Podcaster from 'eleventy-plugin-podcaster'
|
|
29
29
|
|
|
30
30
|
export default function (eleventyConfig) {
|
|
31
31
|
.
|
|
32
32
|
.
|
|
33
|
-
eleventyConfig.addPlugin(
|
|
33
|
+
eleventyConfig.addPlugin(Podcaster)
|
|
34
34
|
.
|
|
35
35
|
.
|
|
36
36
|
}
|
|
@@ -57,7 +57,7 @@ Here's an example.
|
|
|
57
57
|
|
|
58
58
|
## Episode information
|
|
59
59
|
|
|
60
|
-
For each podcast episode you create, you will also create a Eleventy template
|
|
60
|
+
For each podcast episode you create, you will also create a corresponding Eleventy template. This template will have the tag `podcastEpisode`; its front matter will contain the information about the episode — the title, the release date, the episode number, the filename and so on — and its content will contain the episode's show notes.
|
|
61
61
|
|
|
62
62
|
Here's an example.
|
|
63
63
|
|
|
@@ -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 |
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
# Optional features
|
|
2
2
|
|
|
3
|
-
**Podcaster** includes some optional features which you might find useful for your podcasting website. These features are turned off by default, in case you want to implement them some other way. You can enable
|
|
3
|
+
**Podcaster** includes some optional features which you might find useful for your podcasting website. These features are turned off by default, in case you want to implement them some other way. You can enable some or all of them when you include the plugin in your eleventy configuration file, like this:
|
|
4
4
|
|
|
5
5
|
```js
|
|
6
6
|
// eleventy.config.js
|
|
7
7
|
|
|
8
|
-
import
|
|
8
|
+
import Podcaster from 'eleventy-plugin-podcaster'
|
|
9
9
|
|
|
10
10
|
export default function (eleventyConfig) {
|
|
11
11
|
.
|
|
12
12
|
.
|
|
13
|
-
eleventyConfig.addPlugin(
|
|
13
|
+
eleventyConfig.addPlugin(Podcaster, {
|
|
14
14
|
handleDrafts: true,
|
|
15
15
|
handleExcerpts: true,
|
|
16
16
|
readableDateLocale: 'en-GB'
|
|
@@ -22,7 +22,7 @@ export default function (eleventyConfig) {
|
|
|
22
22
|
|
|
23
23
|
## Drafts
|
|
24
24
|
|
|
25
|
-
If `handleDrafts` is set to `true`, the plugin will allow you to designate posts as drafts by including `draft: true` in their front matter (or elsewhere in the data cascade). By default, drafts will be included in the build when Eleventy is running in `serve` or `watch` mode, but will be excluded in `build` mode. You can override this default behaviour by setting the `
|
|
25
|
+
If `handleDrafts` is set to `true`, the plugin will allow you to designate posts as drafts by including `draft: true` in their front matter (or elsewhere in the data cascade). By default, drafts will be included in the build when Eleventy is running in `serve` or `watch` mode, but will be excluded in `build` mode. You can override this default behaviour by setting the `INCLUDE_DRAFTS` environment variable to `true` or `false`.
|
|
26
26
|
|
|
27
27
|
## Excerpts
|
|
28
28
|
|
|
@@ -42,6 +42,8 @@ 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"
|
|
46
|
+
"feedEpisodeTitleTemplate": "feed-episode-title.njk"
|
|
45
47
|
}
|
|
46
48
|
```
|
|
47
49
|
|
|
@@ -67,8 +69,29 @@ And here's a detailed description of all of this information.
|
|
|
67
69
|
| `copyright` | The copyright owner of the podcast. If omitted, the value supplied for `author` is used instead. | no |
|
|
68
70
|
| `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
71
|
| `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
72
|
|
|
73
73
|
[categories]: https://podcasters.apple.com/support/1691-apple-podcasts-categories
|
|
74
74
|
[lang]: https://www.rssboard.org/rss-language-codes
|
|
75
|
+
|
|
76
|
+
## Feed episode templates
|
|
77
|
+
|
|
78
|
+
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.
|
|
79
|
+
|
|
80
|
+
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.
|
|
81
|
+
|
|
82
|
+
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.
|
|
83
|
+
|
|
84
|
+
| field | value | required? |
|
|
85
|
+
| ----- | ----- | --------- |
|
|
86
|
+
| `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 |
|
|
87
|
+
| `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 |
|
|
88
|
+
| `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 |
|
|
89
|
+
| `feedEpisodeTitleTemplate` | The name of an title template that will be used to create the title of each episode. The content of this template should be plain text. If it's omitted, the `title` of the episode's post will be used. | no |
|
|
90
|
+
|
|
91
|
+
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.
|
|
92
|
+
|
|
93
|
+
```njk
|
|
94
|
+
<p class="diary-date">{{ post.data.diaryDate | readableDate }}</p>
|
|
95
|
+
<p class="topic">{{ post.data.topic }}</p>
|
|
96
|
+
{{ post.content | safe }}
|
|
97
|
+
```
|
|
@@ -26,12 +26,12 @@ During the build, **Podcaster** will use this JSON file behind the scenes to ret
|
|
|
26
26
|
You can specify another folder for **Podcaster** to use when you include **Podcaster** in your configuration file by specifying a relative or absolute path like this.
|
|
27
27
|
|
|
28
28
|
```js
|
|
29
|
-
import
|
|
29
|
+
import Podcaster from 'eleventy-plugin-podcaster'
|
|
30
30
|
|
|
31
31
|
export default function (eleventyConfig) {
|
|
32
32
|
.
|
|
33
33
|
.
|
|
34
|
-
eleventyConfig.addPlugin(
|
|
34
|
+
eleventyConfig.addPlugin(Podcaster, {
|
|
35
35
|
episodesDir: '~/episodes'
|
|
36
36
|
})
|
|
37
37
|
.
|
|
@@ -45,13 +45,13 @@ When you're building your site locally, you can easily point **Podcaster** at a
|
|
|
45
45
|
|
|
46
46
|
But if you host your site on a Jamstack provider and it's building your site for you, it won't have access to a directory like that. (Your podcast files are too big to store in your repository.)
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
And so with **Podcaster** you can run your build locally first and then commit the resulting `episodesData.json` file to your repository. If you do that, the build process on your host will use the information in that file to work our the size and duration of your episodes.
|
|
49
49
|
|
|
50
50
|
## Skipping the process
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
When Eleventy is running in `--serve` mode,**Podcaster** will analyse your MP3 files only once during a session. To get it to run the analysis again, you need to restart the web server.
|
|
53
53
|
|
|
54
|
-
If you don't want to run the analysis
|
|
54
|
+
If you don't want to run the analysis during a build, you can just set the environment variable `SKIP_EPISODE_CALCULATIONS` to `true`.
|
|
55
55
|
|
|
56
56
|
```sh
|
|
57
57
|
SKIP_EPISODE_CALCULATIONS=true npx @11ty/eleventy --serve
|
package/package.json
CHANGED
package/src/drafts.js
CHANGED
|
@@ -4,9 +4,9 @@ export default (eleventyConfig, options = {}) => {
|
|
|
4
4
|
let hasLoggedAboutDrafts = false
|
|
5
5
|
eleventyConfig.addPreprocessor('drafts', 'md', (data, _content) => {
|
|
6
6
|
let shouldIncludeDrafts = false
|
|
7
|
-
if (process.env.
|
|
7
|
+
if (process.env.INCLUDE_DRAFTS === 'true') {
|
|
8
8
|
shouldIncludeDrafts = true
|
|
9
|
-
} else if (process.env.
|
|
9
|
+
} else if (process.env.INCLUDE_DRAFTS === 'false') {
|
|
10
10
|
shouldIncludeDrafts = false
|
|
11
11
|
} else {
|
|
12
12
|
shouldIncludeDrafts = (process.env.ELEVENTY_RUN_MODE !== 'build')
|
package/src/podcastFeed.njk
CHANGED
|
@@ -45,13 +45,28 @@ eleventyAllowMissingExtension: true
|
|
|
45
45
|
<generator>{{ eleventy.generator }}</generator>
|
|
46
46
|
{% for post in collections.podcastEpisode | reverse %}
|
|
47
47
|
<item>
|
|
48
|
-
|
|
48
|
+
{% if podcast.feedEpisodeTitleTemplate %}
|
|
49
|
+
{%- set episodeTitle -%}
|
|
50
|
+
{% include podcast.feedEpisodeTitleTemplate %}
|
|
51
|
+
{%- endset -%}
|
|
52
|
+
{% else %}
|
|
53
|
+
{%- set episodeTitle = post.data.title -%}
|
|
54
|
+
{%- endif %}
|
|
55
|
+
<title>{{ episodeTitle }}</title>
|
|
49
56
|
<link>{{ post.url | htmlBaseUrl(siteUrl) }}</link>
|
|
50
57
|
<pubDate>{{ post.date | dateToRfc3339 }}</pubDate>
|
|
51
58
|
{% if post.data.episode.seasonNumber -%}
|
|
52
59
|
<itunes:season>{{ post.data.episode.seasonNumber }}</itunes:season>
|
|
53
60
|
{%- endif %}
|
|
54
61
|
<itunes:episode>{{ post.data.episode.episodeNumber }}</itunes:episode>
|
|
62
|
+
{% if podcast.feedEpisodeSummaryTemplate %}
|
|
63
|
+
{%- set episodeSummary -%}
|
|
64
|
+
{% include podcast.feedEpisodeSummaryTemplate %}
|
|
65
|
+
{%- endset -%}
|
|
66
|
+
{% else %}
|
|
67
|
+
{%- set episodeSummary = post.content | striptags(true) | truncate(500) -%}
|
|
68
|
+
{%- endif %}
|
|
69
|
+
<itunes:summary>{{ episodeSummary }}</itunes:summary>
|
|
55
70
|
{% if podcast.feedEpisodeDescriptionTemplate %}
|
|
56
71
|
{%- set episodeDescription -%}
|
|
57
72
|
{% include podcast.feedEpisodeDescriptionTemplate %}
|
|
@@ -59,7 +74,6 @@ eleventyAllowMissingExtension: true
|
|
|
59
74
|
{% else %}
|
|
60
75
|
{%- set episodeDescription = post.content | striptags(true) | truncate(800) -%}
|
|
61
76
|
{%- endif %}
|
|
62
|
-
<itunes:summary>{{ episodeDescription }}</itunes:summary>
|
|
63
77
|
<description>{{ episodeDescription }}</description>
|
|
64
78
|
{% if podcast.feedEpisodeContentTemplate %}
|
|
65
79
|
{%- set episodeContent -%}
|
|
@@ -68,19 +82,13 @@ eleventyAllowMissingExtension: true
|
|
|
68
82
|
{% else %}
|
|
69
83
|
{%- set episodeContent = post.content -%}
|
|
70
84
|
{% endif %}
|
|
71
|
-
{%- if post.data.page -%}
|
|
72
85
|
<content:encoded>
|
|
73
86
|
<![CDATA[{{ episodeContent | renderTransforms(post.data.page, siteUrl) | safe | trim }}]]>
|
|
74
87
|
</content:encoded>
|
|
75
|
-
{%- else -%}
|
|
76
|
-
<content:encoded>
|
|
77
|
-
<![CDATA[{{ post.content | renderTransforms(post.data.page, siteUrl) | safe | trim }}]]>
|
|
78
|
-
</content:encoded>
|
|
79
|
-
{% endif %}
|
|
80
88
|
<enclosure url="{{ post.data.episode.url }}" length="{{ post.data.episode.size }}" type="audio/mp3"></enclosure>
|
|
81
89
|
<itunes:duration>{{ post.data.episode.duration | readableDuration }}</itunes:duration>
|
|
82
90
|
{%- if post.data.guid != undefined %}
|
|
83
|
-
<guid isPermalink="false">{{ post.data.
|
|
91
|
+
<guid isPermalink="false">{{ post.data.guid }}</guid>
|
|
84
92
|
{% else %}
|
|
85
93
|
<guid isPermalink="true">{{ post.url | htmlBaseUrl(siteUrl) }}</guid>
|
|
86
94
|
{% endif -%}
|