eleventy-plugin-podcaster 0.9.4 → 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/optional-features.md +4 -4
- package/docs/podcast-information.md +2 -0
- package/docs/size-and-duration.md +5 -5
- package/package.json +1 -1
- package/src/drafts.js +2 -2
- package/src/podcastFeed.njk +8 -1
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
|
|
|
@@ -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
|
|
|
@@ -43,6 +43,7 @@ However, `eleventy-plugin-podcast` is quite customisable. He's another `podcast.
|
|
|
43
43
|
"feedEpisodeContentTemplate": "feed-episode-content.njk",
|
|
44
44
|
"feedEpisodeDescriptionTemplate": "feed-episode-description.njk"
|
|
45
45
|
"feedEpisodeSummaryTemplate": "feed-episode-summary.njk"
|
|
46
|
+
"feedEpisodeTitleTemplate": "feed-episode-title.njk"
|
|
46
47
|
}
|
|
47
48
|
```
|
|
48
49
|
|
|
@@ -85,6 +86,7 @@ However, if you want to, you can override any or all of these three textual desc
|
|
|
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 |
|
|
86
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 |
|
|
87
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 |
|
|
88
90
|
|
|
89
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.
|
|
90
92
|
|
|
@@ -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,7 +45,14 @@ 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 -%}
|