generated from polymech/site-template
howto md overlay
This commit is contained in:
parent
5c45c17edc
commit
baf196ff2d
@ -23,7 +23,7 @@
|
||||
"format": "unix-time"
|
||||
}
|
||||
],
|
||||
"default": "2025-03-27T12:41:42.416Z"
|
||||
"default": "2025-03-27T13:50:50.493Z"
|
||||
},
|
||||
"description": {
|
||||
"type": "string",
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -19,6 +19,7 @@ import { blacklist } from './filters.js'
|
||||
import { download } from './download.js'
|
||||
|
||||
import { filter } from "@/base/kbot.js"
|
||||
import { slugify } from "@/base/strings.js"
|
||||
import type { IAnnotation } from "./annotation.js"
|
||||
import { AnnotationMode, generateCacheKey, cacheAnnotation, getCachedAnnotation } from './annotation.js'
|
||||
|
||||
@ -192,6 +193,56 @@ const complete = async (item: IHowto) => {
|
||||
...item.steps.map(step => step.text)
|
||||
].filter(Boolean).join('\n\n')
|
||||
|
||||
const itemDir = item_path(item)
|
||||
|
||||
// Store description
|
||||
const descriptionContent = [
|
||||
'---',
|
||||
`title: ${item.title}`,
|
||||
`slug: ${item.slug}`,
|
||||
`description: ${item.description}`,
|
||||
`tags: ${JSON.stringify(item.tags)}`,
|
||||
`category: ${item.category?.label || 'uncategorized'}`,
|
||||
`difficulty: ${item.difficulty_level}`,
|
||||
`time: ${item.time}`,
|
||||
`location: ${item.user?.geo ? `${item.user.geo.city ? `${item.user.geo.city}, ` : ''}${item.user.geo.countryName || ''}` : ''}`,
|
||||
'---',
|
||||
'',
|
||||
`# ${item.title}`,
|
||||
'',
|
||||
item.cover_image ? `` : '',
|
||||
'',
|
||||
item.description,
|
||||
userLocation
|
||||
].filter(Boolean).join('\n')
|
||||
write(path.join(itemDir, `${item.slug}.md`), descriptionContent)
|
||||
|
||||
// Store each step
|
||||
await pMap(item.steps, async (step, index) => {
|
||||
const stepSlug = slugify(step.title)
|
||||
const stepContent = [
|
||||
'---',
|
||||
`title: ${step.title}`,
|
||||
`slug: ${stepSlug}`,
|
||||
`step: ${index + 1}`,
|
||||
`howto: ${item.slug}`,
|
||||
`tags: ${JSON.stringify(item.tags)}`,
|
||||
`category: ${item.category?.label || 'uncategorized'}`,
|
||||
`difficulty: ${item.difficulty_level}`,
|
||||
`time: ${item.time}`,
|
||||
`location: ${item.user?.geo ? `${item.user.geo.city ? `${item.user.geo.city}, ` : ''}${item.user.geo.countryName || ''}` : ''}`,
|
||||
'---',
|
||||
'',
|
||||
`# Step ${index + 1}: ${step.title}`,
|
||||
'',
|
||||
step.text,
|
||||
'',
|
||||
// Add step images if any
|
||||
...step.images.map(img => ``)
|
||||
].filter(Boolean).join('\n')
|
||||
write(path.join(itemDir, `${stepSlug}.md`), stepContent)
|
||||
})
|
||||
|
||||
return item
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user