- Add `.cache` to `.gitignore` for temporary build files. - Introduce Markdown snippets for creating Season 1 and Season 5 show notes in `.vscode/markdown.code-snippets`. - Update `.vscode/settings.json`: - Exclude `node_modules` directory. - Adjust quick suggestions to disable them for comments, strings, and others. - Remove unnecessary `console.log` statements from `episodes.11tydata.js`. - Add an image file `content/episodes/image.jpg`. - Implement a transcript search feature: - Add `search-transcripts.hbs` to enable searching transcript cues with time markers. - Add `transcript-index.11ty.js` to generate a searchable transcript index. - Update `search-index.11ty.js` to skip processing `<hr>` and `<img>` tags. - Enhance episode layout with `startAt` query parameter to allow audio playback from a specific time. - Add a new dependency: - `@11ty/eleventy-fetch` for fetching transcripts. - `media-captions` for parsing and handling transcript files. - Update package-lock.json and package.json to include new dependencies.
26 lines
642 B
JavaScript
26 lines
642 B
JavaScript
const { convert } = require('html-to-text');
|
|
|
|
class SearchIndex {
|
|
data() {
|
|
return {eleventyExcludeFromCollections:["episode"], layout: null}
|
|
}
|
|
|
|
render (data) {
|
|
const documents = data.collections.episode.map((episode)=>{
|
|
return {
|
|
url:`${this.url(episode.url)}`,
|
|
title: episode.data.title,
|
|
text: convert (episode.content, {
|
|
selectors: [
|
|
{ selector: 'hr', format: 'skip' },
|
|
{ selector: 'img', format: 'skip'}
|
|
]
|
|
}),
|
|
season: episode.data.season,
|
|
episode: episode.data.episode
|
|
}})
|
|
return JSON.stringify(documents);
|
|
}
|
|
}
|
|
|
|
module.exports = SearchIndex |