-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparse.js
25 lines (21 loc) · 992 Bytes
/
parse.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import {collect, getDocuments, getEntry} from 'content-structure'
import {fileURLToPath} from 'url';
import {dirname,join} from 'path'
const rootdir = dirname(fileURLToPath(import.meta.url))
await collect({
rootdir:rootdir,
contentdir:join(rootdir,"content"),
content_ext:["md","json","yml","yaml"],
assets_ext:["svg","webp","png","jpeg","jpg","xlsx","glb"],
outdir:join(rootdir,".structure"),
debug:true
})
const documents = await getDocuments()
console.log(`\nobtained ${documents.length} documents`)
const authors = await getDocuments({content_type:"authors"})
console.log(`found ${authors.length} authors`)
const generic_markdown = await getDocuments({format:"markdown",content_type:"generic"})
console.log(`found ${generic_markdown.length} generic markdown entries`)
const image_entry = await getEntry({slug:"image"})
const images_urls = image_entry.data.images.map(image=>image.url)
console.log(`'image' content entry has following images '${images_urls}'`)