eleventy-plugin-podcaster 2.2.9 → 2.2.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eleventy-plugin-podcaster",
3
- "version": "2.2.9",
3
+ "version": "2.2.11",
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": {
@@ -147,7 +147,7 @@ export default function (eleventyConfig, options = {}) {
147
147
  const s3Storage = getS3Storage(options)
148
148
  const s3Bucket = options.s3Storage.bucket
149
149
  episodeData = await calculateEpisodeDataFromS3Bucket(s3Storage, s3Bucket)
150
- cacheEpisodeDataToS3Bucket(s3Storage, s3Bucket, episodeData)
150
+ await cacheEpisodeDataToS3Bucket(s3Storage, s3Bucket, episodeData)
151
151
  await writeFile(cachedEpisodeDataPath, JSON.stringify(episodeData, null, 2))
152
152
  } else if (existsSync(cachedEpisodeDataPath)) {
153
153
  episodeData = JSON.parse(readFileSync(cachedEpisodeDataPath))
@@ -39,7 +39,11 @@ export default function (eleventyConfig, options = {}) {
39
39
 
40
40
  eleventyConfig.addGlobalData('eleventyComputed.permalink', () => {
41
41
  return data => {
42
- if (data.permalink) return data.permalink
42
+ if (data.permalink === false && isEpisodePost(data, options)) {
43
+ throw new Error(`[eleventy-plugin-podcaster] Episode posts cannot have \`permalink: false\`. See ${data.page.inputPath}.`)
44
+ }
45
+
46
+ if (data.permalink || data.permalink === false) return data.permalink
43
47
 
44
48
  if (data.podcast.episodePermalinkPattern) {
45
49
  return data.podcast.episodePermalinkPattern
@@ -19,7 +19,7 @@ eleventyAllowMissingExtension: true
19
19
  <description>{{ podcast.description }}</description>
20
20
  <language>{{ podcast.language }}</language>
21
21
  <copyright>{{ podcast.copyrightNotice }}</copyright>
22
- <pubDate>{{ collections.episodePost | getNewestCollectionItemDate | dateToRfc3339 }}</pubDate>
22
+ <pubDate>{{ collections.episodePost | getNewestCollectionItemDate | dateToRfc822('UTC') }}</pubDate>
23
23
  <lastBuildDate>{{ podcast.feedLastBuildDate }}</lastBuildDate>
24
24
  <itunes:image href="{{ podcast.imagePath | htmlBaseUrl(siteUrl) }}"></itunes:image>
25
25
  {%- if podcast.subcategory %}
@@ -63,7 +63,7 @@ eleventyAllowMissingExtension: true
63
63
  {% else %}
64
64
  <guid isPermaLink="true">{{ post.url | htmlBaseUrl(siteUrl) }}</guid>
65
65
  {% endif -%}
66
- <pubDate>{{ post.date | dateToRfc3339 }}</pubDate>
66
+ <pubDate>{{ post.date | dateToRfc822('UTC') }}</pubDate>
67
67
  {%- if post.data.episode.chapters is string %}
68
68
  <podcast:chapters url="{{ post.data.episode.chapters | htmlBaseUrl(siteUrl) }}"
69
69
  type="application/json+chapters" />
@@ -21,6 +21,8 @@ export default function (eleventyConfig, options = {}) {
21
21
  })
22
22
 
23
23
  eleventyConfig.addFilter('readableSize', (bytes, fixedPrecision = 1) => {
24
+ if (isNaN(bytes)) return 'NaN kB'
25
+ if (bytes === 0) return '0 kB'
24
26
  if (bytes < 1000 * 1000) return `${(bytes / 1000).toFixed(fixedPrecision)} kB`
25
27
  if (bytes < 1000 * 1000 * 1000) return `${(bytes / 1000 / 1000).toFixed(fixedPrecision)} MB`
26
28
  return `${(bytes / 1000 / 1000 / 1000).toFixed(fixedPrecision)} GB`