Skip to content

Commit 5207641

Browse files
authored
Docusaurus v2 (#786)
* generate docusaurus v2 template site * format all * migrate docusaurus v2 * use docusaurus v2 (MVP)
1 parent 01296b7 commit 5207641

16 files changed

+3303
-3618
lines changed

.lintstagedrc.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
- eslint --fix
33
- prettier --write
44

5-
'*.{md,json,yml,yaml,css,html,toml}':
6-
- prettier --write
5+
'*':
6+
- prettier --ignore-unknown --write

website/.npmrc

Lines changed: 0 additions & 2 deletions
This file was deleted.

website/README.md

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,41 @@
1-
See the `docs/` folder for writing documentation.
1+
# Website
2+
3+
This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator.
4+
5+
### Installation
6+
7+
```
8+
$ yarn
9+
```
10+
11+
### Local Development
12+
13+
```
14+
$ yarn start
15+
```
16+
17+
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
18+
19+
### Build
20+
21+
```
22+
$ yarn build
23+
```
24+
25+
This command generates static content into the `build` directory and can be served using any static contents hosting service.
26+
27+
### Deployment
28+
29+
Using SSH:
30+
31+
```
32+
$ USE_SSH=true yarn deploy
33+
```
34+
35+
Not using SSH:
36+
37+
```
38+
$ GIT_USER=<Your GitHub username> yarn deploy
39+
```
40+
41+
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.

website/docusaurus.config.js

Lines changed: 110 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,96 +1,130 @@
1-
/** @type {import('@docusaurus/types').DocusaurusConfig} */
2-
module.exports = {
1+
// @ts-check
2+
// Note: type annotations allow type checking and IDEs autocompletion
3+
4+
const lightCodeTheme = require('prism-react-renderer/themes/github')
5+
const darkCodeTheme = require('prism-react-renderer/themes/dracula')
6+
7+
/** @type {import('@docusaurus/types').Config} */
8+
const config = {
39
title: 'Blink',
4-
tagline: 'Link Shortener',
10+
tagline: 'Modern, lightweight, planet-scale link shortener for teams',
11+
favicon: 'img/favicon.ico',
12+
13+
// Set the production url of your site here
514
url: 'https://docs.blink.rest',
15+
// Set the /<baseUrl>/ pathname under which your site is served
16+
// For GitHub pages deployment, it is often '/<projectName>/'
617
baseUrl: '/',
18+
19+
// GitHub pages deployment config.
20+
// If you aren't using GitHub pages, you don't need these.
21+
// organizationName: 'facebook', // Usually your GitHub org/user name.
22+
// projectName: 'docusaurus', // Usually your repo name.
23+
724
onBrokenLinks: 'throw',
825
onBrokenMarkdownLinks: 'warn',
9-
favicon: 'img/favicon.ico',
10-
organizationName: 'JaneJeon', // Usually your GitHub org/user name.
11-
projectName: 'blink', // Usually your repo name.
12-
themeConfig: {
13-
navbar: {
14-
title: 'Blink',
15-
logo: {
16-
alt: 'My Site Logo',
17-
src: 'img/logo.svg'
18-
},
19-
items: [
20-
{
21-
to: '/',
22-
activeBasePath: 'docs',
23-
label: 'Docs',
24-
position: 'left'
25-
},
26-
{
27-
href: 'https://github.com/JaneJeon/blink',
28-
label: 'GitHub',
29-
position: 'right'
30-
}
31-
]
32-
},
33-
footer: {
34-
style: 'dark',
35-
links: [
36-
// {
37-
// title: 'Docs',
38-
// items: [
39-
// {
40-
// label: 'Getting Started',
41-
// to: 'docs/'
42-
// }
43-
// ]
44-
// },
45-
// {
46-
// title: 'Community',
47-
// items: [
48-
// {
49-
// label: 'Stack Overflow',
50-
// href: 'https://stackoverflow.com/questions/tagged/docusaurus'
51-
// },
52-
// {
53-
// label: 'Discord',
54-
// href: 'https://discordapp.com/invite/docusaurus'
55-
// },
56-
// {
57-
// label: 'Twitter',
58-
// href: 'https://twitter.com/docusaurus'
59-
// }
60-
// ]
61-
// },
62-
// {
63-
// title: 'More',
64-
// items: [
65-
// {
66-
// label: 'GitHub',
67-
// href: 'https://github.com/JaneJeon/blink'
68-
// }
69-
// ]
70-
// }
71-
],
72-
copyright: `Copyright © ${new Date().getFullYear()} Jane Jeon`
73-
},
74-
algolia: {
75-
apiKey: process.env.ALGOLIA_API_KEY,
76-
indexName: 'blink'
77-
}
26+
27+
// Even if you don't use internalization, you can use this field to set useful
28+
// metadata like html lang. For example, if your site is Chinese, you may want
29+
// to replace "en" with "zh-Hans".
30+
i18n: {
31+
defaultLocale: 'en',
32+
locales: ['en']
7833
},
34+
7935
presets: [
8036
[
81-
'@docusaurus/preset-classic',
82-
{
37+
'classic',
38+
/** @type {import('@docusaurus/preset-classic').Options} */
39+
({
8340
docs: {
8441
sidebarPath: require.resolve('./sidebars.js'),
8542
// Please change this to your repo.
43+
// Remove this to remove the "edit this page" links.
8644
editUrl: 'https://github.com/JaneJeon/blink/edit/master/website/',
8745
routeBasePath: '/'
8846
},
8947
theme: {
9048
customCss: require.resolve('./src/css/custom.css')
9149
}
92-
}
50+
})
9351
]
9452
],
95-
plugins: ['@docusaurus/plugin-ideal-image']
53+
54+
themeConfig:
55+
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
56+
({
57+
colorMode: {
58+
respectPrefersColorScheme: true
59+
},
60+
// Replace with your project's social card
61+
// image: 'img/docusaurus-social-card.jpg',
62+
navbar: {
63+
title: 'Blink',
64+
// logo: {
65+
// alt: 'My Site Logo',
66+
// src: 'img/logo.svg'
67+
// },
68+
items: [
69+
{
70+
to: '/',
71+
activeBasePath: 'docs',
72+
label: 'Docs',
73+
position: 'left'
74+
},
75+
{
76+
href: 'https://github.com/JaneJeon/blink',
77+
position: 'right',
78+
className: 'header-github-link'
79+
}
80+
]
81+
},
82+
footer: {
83+
style: 'dark',
84+
links: [
85+
// {
86+
// title: 'Docs',
87+
// items: [
88+
// {
89+
// label: 'Tutorial',
90+
// to: '/docs/intro'
91+
// }
92+
// ]
93+
// },
94+
// {
95+
// title: 'Community',
96+
// items: [
97+
// {
98+
// label: 'Stack Overflow',
99+
// href: 'https://stackoverflow.com/questions/tagged/docusaurus'
100+
// },
101+
// {
102+
// label: 'Discord',
103+
// href: 'https://discordapp.com/invite/docusaurus'
104+
// },
105+
// {
106+
// label: 'Twitter',
107+
// href: 'https://twitter.com/docusaurus'
108+
// }
109+
// ]
110+
// },
111+
// {
112+
// title: 'More',
113+
// items: [
114+
// {
115+
// label: 'GitHub',
116+
// href: 'https://github.com/facebook/docusaurus'
117+
// }
118+
// ]
119+
// }
120+
],
121+
copyright: `Copyright © ${new Date().getFullYear()} Jane Jeon`
122+
},
123+
prism: {
124+
theme: lightCodeTheme,
125+
darkTheme: darkCodeTheme
126+
}
127+
})
96128
}
129+
130+
module.exports = config

0 commit comments

Comments
 (0)