-
Notifications
You must be signed in to change notification settings - Fork 2
/
static.config.js
60 lines (56 loc) · 1.33 KB
/
static.config.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import path from 'path'
import jdown from 'jdown'
import chokidar from 'chokidar'
// Note: v6 reloadRoutes is now reloadClientData
// chokidar.watch('content').on('all', () => reloadClientData())
// reloadClientData() // Ok with just this
// nn
// setInterval(reloadClientData, 5 * 1000)
export default {
getSiteData: () => ({
title: 'DWeb Blog TEST getSiteData-TITLE',
}),
getRoutes: async () => {
const { posts, home, about } = await jdown('content')
// console.log('home: %o', home)
// console.log('about: %o', about)
// console.log('posts: %o', posts)
return [
{
path: '/',
getData: () => ({
...home,
}),
},
{
path: '/about',
getData: () => ({
about,
}),
},
{
path: '/blog',
getData: () => ({
posts,
}),
children: posts.map(post => ({
path: `/post/${post.slug}`,
template: 'src/containers/Post',
getData: () => ({
post,
}),
})),
},
]
},
plugins: [
[
require.resolve('react-static-plugin-source-filesystem'),
{
location: path.resolve('./src/pages'),
},
],
require.resolve('react-static-plugin-reach-router'),
require.resolve('react-static-plugin-sitemap'),
],
}