Skip to content

Commit 175c89a

Browse files
committed
ci(cli): add images path in new learn content
1 parent 52e3027 commit 175c89a

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

bin/commands/generate/content.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,15 @@ export const content = defineCommand({
5959
const learnTemplatePath = getLearnTemplatePath()
6060
const template = readFileSync(learnTemplatePath, 'utf-8')
6161

62-
const content = template.replace('learn_title', title).replaceAll('learn_date', date).replace('learn_category', category)
63-
64-
const path = join(learnPath, filename)
65-
writeContent(content, path)
66-
6762
const learnImages = getLearnImagesPath()
6863
const imagesPath = join(learnImages, filename.replace('.md', ''))
6964
generateImageFolder(imagesPath)
7065

66+
const content = template.replace('learn_title', title).replaceAll('learn_date', date).replace('learn_category', category).replace('images_path', imagesPath.split('/public').pop() || '')
67+
68+
const path = join(learnPath, filename)
69+
writeContent(content, path)
70+
7171
consola.success(`Successfully generated at:\nContent: ${path}\nImages: ${imagesPath}`)
7272
}
7373
},

content/learn/articles/.template.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ publishedAt: learn_date
1616
modifiedAt: learn_date
1717
---
1818

19-
Checklist:
20-
21-
- [ ] Packages must match the package filename
19+
<!--
20+
Images Path: images_path
21+
-->

0 commit comments

Comments
 (0)