-
Notifications
You must be signed in to change notification settings - Fork 0
/
static.config.js
84 lines (83 loc) · 2.41 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import axios from 'axios'
import React from 'react'
import path from 'path'
export default {
siteRoot: 'https://miguelo12.github.io',
basePath: 'portfolio',
devBasePath: 'portfolio',
maxThreads: 2,
devServer: {
port: 3000,
host: 'localhost',
},
entry: path.join(__dirname, 'src', 'main.tsx'),
getSiteProps: () => ({
title: 'My portfolio'
}),
getRoutes: async () => {
const { data: posts } = await axios.get(
'https://jsonplaceholder.typicode.com/posts'
)
const linktecnology = [
{"name": "React-Static", "url": "https://github.com/react-static/react-static"},
{"name": "Ant-Design", "url": "https://github.com/ant-design/ant-design"},
{"name": "Typescript", "url": "https://github.com/microsoft/TypeScript"},
{"name": "Reach Router", "url": "https://github.com/reach/router"},
{"name": "React Hot Loader", "url": "https://github.com/gaearon/react-hot-loader"},
{"name": "gh-pages", "url": "https://github.com/tschaub/gh-pages"},
{"name": "Axios", "url": "https://github.com/axios/axios"},
]
return [
{
path: '/blog',
getData: () => ({
posts,
}),
children: posts.map((post) => ({
path: `/post/${post.id}/`,
template: 'src/pages/post',
getData: () => ({
post,
}),
})),
},
{
path: '/',
getData: () => ({
linktecnology,
})
}
]
},
plugins: [
'react-static-plugin-typescript',
[
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'),
],
Document: ({
Html,
Head,
Body,
children,
state: { siteData, renderMeta },
}) => (
<Html lang="en-US">
<Head>
<meta charSet="UTF-8" />
<title>Portfolio</title>
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
<link rel="manifest" href="/site.webmanifest"></link>
<meta name="viewport" content="width=device-width, initial-scale=1" />
</Head>
<Body>{children}</Body>
</Html>
),
}