Skip to content

Commit 18ab5ba

Browse files
528-article-default-image (#529)
* fixed bug where VTT files were being picked up as article files * use default image path when article does not have a YouTube video code
1 parent eba3212 commit 18ab5ba

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

scripts/generate_learning_path_markdown.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ const getYouTubeCode = (section, articleNumber) => {
2121
return ''
2222
}
2323

24-
const getYouTubeImage = (youTubeCode) => {
24+
const getArticleImage = (youTubeCode) => {
2525
if (youTubeCode) {
2626
return `https://img.youtube.com/vi/${youTubeCode}/mqdefault.jpg`
2727
}
28-
return ''
28+
return 'images/learn/LP-article-default.png'
2929
}
3030

3131
(async () => {
@@ -77,7 +77,7 @@ const getYouTubeImage = (youTubeCode) => {
7777
const frontMatter = {
7878
title: articleTitle,
7979
contributors,
80-
image: getYouTubeImage(youtubeCode),
80+
image: getArticleImage(youtubeCode),
8181
featured: weight === 1,
8282
weight,
8383
youtubeCode

scripts/get_article_files.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const { join } = require('path')
44
module.exports = getArticleFiles = (path) => {
55
return fs.readdirSync(path).reduce((articles, filename) => {
66
const filePath = join(path, filename)
7-
if (filePath.match(/\d\d/) && !filePath.includes('-script.asciidoc')) {
7+
if (filePath.match(/\d\d[-\w]+(?<!script)\.asciidoc/)) {
88
return [...articles, {
99
filePath,
1010
asciiDoc: fs.readFileSync(filePath, 'utf-8')
@@ -13,4 +13,4 @@ module.exports = getArticleFiles = (path) => {
1313
return articles
1414
}
1515
}, [])
16-
}
16+
}

0 commit comments

Comments
 (0)