eleventy-plugin-podcaster 0.9.2 → 0.9.3

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 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:
@@ -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'`.
@@ -56,15 +56,17 @@ export default function (eleventyConfig, options = {}) {
56
56
 
57
57
  eleventyConfig.addShortcode('year', () => DateTime.now().year)
58
58
 
59
- eleventyConfig.addFilter('readableDate', function (date) {
60
- if (date instanceof Date) {
61
- date = date.toISOString()
62
- }
63
- const result = DateTime.fromISO(date, {
64
- zone: 'UTC'
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
- return result.setLocale('en-GB').toLocaleString(DateTime.DATE_HUGE)
67
- })
69
+ }
68
70
 
69
71
  eleventyConfig.addFilter('readableDuration', function (seconds) {
70
72
  if (!seconds) return '0:00:00'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eleventy-plugin-podcaster",
3
- "version": "0.9.2",
3
+ "version": "0.9.3",
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": {
@@ -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(podcast.siteUrl) }}"></itunes:image>
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,24 +46,35 @@ 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(podcast.siteUrl) }}</link>
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
- <itunes:summary>{{ post.content | striptags(true) | truncate(800) }}</itunes:summary>
56
- <description>{{ post.content | striptags(true) | truncate(800) }}</description>
55
+ {% if podcast.feedEpisodeDescriptionTemplate %}
56
+ {%- set episodeDescription -%}
57
+ {% include podcast.feedEpisodeDescriptionTemplate %}
58
+ {%- endset -%}
59
+ {% else %}
60
+ {%- set episodeDescription = post.content | striptags(true) | truncate(800) -%}
61
+ {%- endif %}
62
+ <itunes:summary>{{ episodeDescription }}</itunes:summary>
63
+ <description>{{ episodeDescription }}</description>
57
64
  {% if podcast.feedEpisodeContentTemplate %}
58
65
  {%- set episodeContent -%}
59
66
  {% include podcast.feedEpisodeContentTemplate %}
60
67
  {%- endset -%}
68
+ {% else %}
69
+ {%- set episodeContent = post.content -%}
70
+ {% endif %}
71
+ {%- if post.data.page -%}
61
72
  <content:encoded>
62
- <![CDATA[{{ episodeContent | renderTransforms(post.data.page, podcast.siteUrl) | safe | trim }}]]>
73
+ <![CDATA[{{ episodeContent | renderTransforms(post.data.page, siteUrl) | safe | trim }}]]>
63
74
  </content:encoded>
64
75
  {%- else -%}
65
76
  <content:encoded>
66
- <![CDATA[{{ post.content | renderTransforms(post.data.page, podcast.siteUrl) | safe | trim }}]]>
77
+ <![CDATA[{{ post.content | renderTransforms(post.data.page, siteUrl) | safe | trim }}]]>
67
78
  </content:encoded>
68
79
  {% endif %}
69
80
  <enclosure url="{{ post.data.episode.url }}" length="{{ post.data.episode.size }}" type="audio/mp3"></enclosure>
@@ -71,7 +82,7 @@ eleventyAllowMissingExtension: true
71
82
  {%- if post.data.guid != undefined %}
72
83
  <guid isPermalink="false">{{ post.data.episode.guid }}</guid>
73
84
  {% else %}
74
- <guid isPermalink="true">{{ post.url | htmlBaseUrl(podcast.siteUrl) }}</guid>
85
+ <guid isPermalink="true">{{ post.url | htmlBaseUrl(siteUrl) }}</guid>
75
86
  {% endif -%}
76
87
  {%- if post.data.explicit != undefined %}
77
88
  <itunes:explicit>{{ post.data.explicit }}</itunes:explicit>