Skip to content

Commit 727e385

Browse files
authored
Удаляет с заголовков в подкасте временные метки аудио (#402)
1 parent 08e7f38 commit 727e385

File tree

1 file changed

+0
-28
lines changed

1 file changed

+0
-28
lines changed

src/eleventy-config/transforms.js

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -155,34 +155,6 @@ export default function(eleventyConfig) {
155155
return content;
156156
});
157157

158-
// добавление на заголовки id с временными метками внутри страниц подкастов
159-
eleventyConfig.addTransform('podcast-headings', async function(content) {
160-
if (!this.page?.outputPath?.endsWith?.('html')) {
161-
return content;
162-
}
163-
164-
// игнорируем страницы, не попадающие под url вида `/podcast/<номер подкаста>/`
165-
if (!(/\podcast\/\d+\//.test(this.page?.url))) {
166-
return content;
167-
}
168-
169-
const { document } = parseHTML(content);
170-
171-
const titlesMap = Array.from(document.querySelectorAll('.podcast__content h2'))
172-
.reduce((map, titleElement) => {
173-
map[titleElement.textContent.trim()] = titleElement;
174-
return map;
175-
}, {});
176-
177-
for (const chapterElement of document.querySelectorAll('.podcast__timecode-chapter')) {
178-
const titleText = chapterElement.querySelector('.podcast__timecode-title').textContent.trim();
179-
const timeCode = chapterElement.querySelector('.podcast__timecode-link').textContent.trim();
180-
titlesMap[titleText]?.setAttribute('id', timeCode);
181-
}
182-
183-
return document.toString();
184-
});
185-
186158
// добавление id на заголовки и кнопок для копирования ссылок
187159
eleventyConfig.addTransform('content-headings', async function(content) {
188160
if (!this.page?.outputPath?.endsWith?.('html')) {

0 commit comments

Comments
 (0)