eleventy-plugin-podcaster 2.2.5 → 2.2.7

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.
@@ -8,6 +8,7 @@ import calculateEpisodeFilename from './src/calculateEpisodeFilename.js'
8
8
  import validation from './src/validation.js'
9
9
  import readableFilters from './src/readableFilters.js'
10
10
  import chapters from './src/chapters.js'
11
+ import transcriptMimeTypes from './src/transcriptMimeTypes.js'
11
12
  import excerpts from './src/excerpts.js'
12
13
  import drafts from './src/drafts.js'
13
14
  import pageTitle from './src/pageTitle.js'
@@ -30,6 +31,8 @@ export default function (eleventyConfig, options = {}) {
30
31
  eleventyConfig.addPlugin(readableFilters, options)
31
32
  eleventyConfig.addPlugin(chapters, options)
32
33
 
34
+ eleventyConfig.addPlugin(transcriptMimeTypes)
35
+
33
36
  // Optional features
34
37
 
35
38
  if (options.optionalFeatures) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eleventy-plugin-podcaster",
3
- "version": "2.2.5",
3
+ "version": "2.2.7",
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": {
@@ -107,7 +107,7 @@ eleventyAllowMissingExtension: true
107
107
  <itunes:episodeType>{{ post.data.episode.type }}</itunes:episodeType>
108
108
  {% endif -%}
109
109
  {%- if post.data.episode.transcript %}
110
- <podcast:transcript url="{{ post.data.episode.transcript | htmlBaseUrl(siteUrl) }}"></podcast:transcript>
110
+ <podcast:transcript url="{{ post.data.episode.transcript | htmlBaseUrl(siteUrl) }}" type="{{ post.data.episode.transcript | transcriptMimeType }}"></podcast:transcript>
111
111
  {%- endif %}
112
112
  {%- if post.data.episode.block === true %}
113
113
  <itunes:block>Yes</itunes:block>
@@ -0,0 +1,12 @@
1
+ export default function (eleventyConfig) {
2
+ eleventyConfig.addFilter('transcriptMimeType', (filePath) => {
3
+ const mimeTypes = {
4
+ srt: 'application/x-subrip',
5
+ vtt: 'text/vtt',
6
+ json: 'application/json',
7
+ html: 'text/html'
8
+ }
9
+ const extension = filePath.split('.').pop()
10
+ return mimeTypes[extension] || 'text/plain'
11
+ })
12
+ }