forked from thepeacockproject/peacockprojectorg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
testimonialsPlugin.js
34 lines (29 loc) · 936 Bytes
/
testimonialsPlugin.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
26
27
28
29
30
31
32
33
34
const fs = require("fs/promises")
module.exports = function () {
return {
name: "docusaurus-peacock-testmonials-plugin",
async loadContent() {
return JSON.parse(
(await fs.readFile("static/testimonials.json")).toString()
)
},
async contentLoaded({ content, actions }) {
const testiDataPath = await actions.createData(
"testimonialsData.json",
JSON.stringify(content)
)
actions.addRoute({
path: "/testimonials",
component: "@site/src/components/TestimonialsComponent",
modules: {
// propName -> JSON file path
data: testiDataPath,
},
exact: true,
})
},
getPathsToWatch() {
return ["static/testimonials.json"]
},
}
}