@ssgjs/source-remark
TypeScript icon, indicating that this package has built-in type declarations

0.0.10 • Public • Published

@ssgjs/source-remark

generate indexes via filesystem, and then use the remark ecosystem to generate data slices

// ssg.config.js
const remark = require('@ssgjs/source-remark')
const writing = remark({ dirPath: 'content/writing' })
const speaking = remark({ dirPath: 'content/talks' })

exports.plugins = {
  writing,
  speaking
}

// not needed
exports.getDataSlice = async (key, uid) => {
  console.log('optional getDataSlice action')
  // etc
}


// mandatory. called once, should be cheap
exports.createIndex = async (mainIndex = {}) => {
  console.log('getting intial data')
  // can add more data to index here
  console.log('Number of talks:', Object.keys(mainIndex.speaking).length)
  console.log('Number of articles:', Object.keys(mainIndex.writing).length)
  return mainIndex
}

Readme

Keywords

Package Sidebar

Install

npm i @ssgjs/source-remark

Weekly Downloads

11

Version

0.0.10

License

MIT

Unpacked Size

18.7 kB

Total Files

7

Last publish

Collaborators

  • sw-yx