Commit Graph

117 Commits

Author SHA1 Message Date
silverwind
07849dda65 Add .npmrc and regenerate package-lock.json (#67)
Same `.npmrc` as in gitea repo which also bumps the lockfile version to v3, meaning npm v7 or higher is required.

Reviewed-on: https://gitea.com/gitea/gitea-docusaurus/pulls/67
Reviewed-by: techknowlogick <techknowlogick@noreply.gitea.com>
Co-authored-by: silverwind <me@silverwind.io>
Co-committed-by: silverwind <me@silverwind.io>
2023-09-07 14:31:43 +00:00
techknowlogick
08bd4581f0 Update .gitea/workflows/build-and-publish.yaml 2023-08-25 00:41:53 +00:00
Lunny Xiao
55f25636ae Fix missed version change 2023-08-22 12:21:19 +08:00
jolheiser
ca34387b0c feat: plausible (#66)
Adds plausible analytics to the docs.

Reviewed-on: https://gitea.com/gitea/gitea-docusaurus/pulls/66
Reviewed-by: silverwind <silverwind@noreply.gitea.com>
Reviewed-by: delvh <dev.lh@web.de>
Co-authored-by: jolheiser <john.olheiser@gmail.com>
Co-committed-by: jolheiser <john.olheiser@gmail.com>
2023-08-22 01:27:01 +00:00
techknowlogick
1097526deb 1.20.3 2023-08-21 16:07:19 +00:00
techknowlogick
9c2c3041e9 1.20.3 2023-08-21 16:07:00 +00:00
techknowlogick
b5fb0c1e2e Update docusaurus.config.js 2023-08-14 15:59:09 +00:00
techknowlogick
9f29a9aff4 Update loop_docs.sh 2023-08-05 20:25:12 +00:00
Denys Konovalov
39f9261333 Fix edit url (#55)
Since the Docusaurus-ify PR series from @jolheiser, the docs pages are no longer inside the doc/ subfolder. Fix the URL for editing a docs page in Docusaurus accordingly.

Reviewed-on: https://gitea.com/gitea/gitea-docusaurus/pulls/55
Reviewed-by: John Olheiser <john+gitea@jolheiser.com>
Co-authored-by: Denys Konovalov <denyskon@noreply.gitea.com>
Co-committed-by: Denys Konovalov <denyskon@noreply.gitea.com>
2023-07-31 17:32:28 +00:00
John Olheiser
53e27a0e86 Clone once (#52)
Closes #30
Closes #31
Closes #42

Rather than partially cloning, instead we clone once and then `clean` (to remove generated files), `reset` (to reset changed files), and `checkout` branches as needed. This should allow the outdated translation check to continue to work while also reducing build times significantly.

Before:
![before](/attachments/07c16ef5-110c-451a-9f1b-79f2c8b72caf)

After:
![after](/attachments/d6251f63-087d-4270-946f-63148b8f642a)

Reviewed-on: https://gitea.com/gitea/gitea-docusaurus/pulls/52
Co-authored-by: John Olheiser <john+gitea@jolheiser.com>
Co-committed-by: John Olheiser <john+gitea@jolheiser.com>
2023-07-28 05:52:35 +00:00
John Olheiser
30a23a1ee4 Use minorVer (#50)
Rather than `version` which is e.g. `1.20` or `1.19` use `minorVer` which is set above as e.g. `1.20.0` or `1.19.4`

78cc25c09d/loop_docs.sh (L30)
Reviewed-on: https://gitea.com/gitea/gitea-docusaurus/pulls/50
2023-07-28 04:41:21 +00:00
jolheiser
c24614753e Update primary color(s) (#53)
Closes #35

One caveat, I used the docusaurus [styling and layout](https://docusaurus.io/docs/styling-layout/#styling-your-site-with-infima) color generator and fiddled until I could get a AA contrast ratio, so the colors aren't as exact as the one suggested in https://gitea.com/gitea/gitea-docusaurus/issues/35#issuecomment-742982 (But it still looks better than the blue-green we currently have imo)

![dark theme](/attachments/153c66eb-bdc6-4758-852c-f6a3beb45cdb)
![light theme](/attachments/c45495a8-e1ab-45a0-ab15-4bbdd887aea5)

Reviewed-on: https://gitea.com/gitea/gitea-docusaurus/pulls/53
Co-authored-by: jolheiser <john.olheiser@gmail.com>
Co-committed-by: jolheiser <john.olheiser@gmail.com>
2023-07-27 23:49:16 +00:00
jolheiser
f397d309d2 Docusaurus-ify main repo (#51)
https://github.com/go-gitea/gitea/pull/26051
https://github.com/go-gitea/gitea/pull/26052
https://github.com/go-gitea/gitea/pull/26053
Reviewed-on: https://gitea.com/gitea/gitea-docusaurus/pulls/51
Co-authored-by: jolheiser <john.olheiser@gmail.com>
Co-committed-by: jolheiser <john.olheiser@gmail.com>
2023-07-27 14:55:46 +00:00
jolheiser
78cc25c09d docs: add awesome and tea (#49)
As title, add awesome-gitea and tea to the footer

Reviewed-on: https://gitea.com/gitea/gitea-docusaurus/pulls/49
Co-authored-by: jolheiser <john.olheiser@gmail.com>
Co-committed-by: jolheiser <john.olheiser@gmail.com>
2023-07-21 15:15:51 +00:00
HesterG
02b0ebc9e1 Add subscription and community components (#47)
Close #46

Same as those in [blog](https://gitea.com/gitea/blog/pulls/272), but for docs and api
Ejected DocPage (unsafe to eject) and ApiDoc (safe to eject) for layout changes

![Screen Shot 2023-07-17 at 15.32.29](/attachments/74f992c7-b60d-4d71-bb50-8c085e6783fe)![Screen Shot 2023-07-17 at 15.32.40](/attachments/0df35cba-0797-4f21-abbe-bb61736c1e1f)

Screenshots

![Screen Shot 2023-07-17 at 15.27.29](/attachments/39e09cee-5043-4349-aaaa-7ab585aefbc4)![Screen Shot 2023-07-17 at 15.27.36](/attachments/396a9ae1-bbae-42b5-b1ab-c4158a2be78d)![Screen Shot 2023-07-17 at 15.27.53](/attachments/e12a35eb-625c-4950-960e-61226eda4ad4)![Screen Shot 2023-07-17 at 15.28.11](/attachments/578bd742-8a8b-4324-82d4-b9dc47d7f511)![Screen Shot 2023-07-17 at 15.28.19](/attachments/f304bb80-c6cb-4af4-b16f-b19fa2099ba5)

Co-authored-by: techknowlogick <techknowlogick@noreply.gitea.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Reviewed-on: https://gitea.com/gitea/gitea-docusaurus/pulls/47
Co-authored-by: HesterG <hestergong@gmail.com>
Co-committed-by: HesterG <hestergong@gmail.com>
2023-07-21 10:57:22 +00:00
jolheiser
c77d0e0e34 Update footer (#48)
Add more to community footer, change `More` to `Code` and add gitea.com, and remove `Docs` section that just linked back to home.

Reviewed-on: https://gitea.com/gitea/gitea-docusaurus/pulls/48
Co-authored-by: jolheiser <john.olheiser@gmail.com>
Co-committed-by: jolheiser <john.olheiser@gmail.com>
2023-07-21 03:51:34 +00:00
techknowlogick
f585f6554a update nav link 2023-07-19 13:57:52 -04:00
techknowlogick
0105968d98 add 1.19 back in 2023-07-19 13:40:14 -04:00
techknowlogick
cf21dd155f Revert "Update docusaurus.config.js"
This reverts commit f8eecadedb.
2023-07-19 13:38:40 -04:00
techknowlogick
f8eecadedb Update docusaurus.config.js
Update .gitea/workflows/build-and-publish.yaml

Delete versioned_sidebars/version-1.19-sidebars.json

Update loop_docs.sh

Update versions.json

Update docusaurus.config.js
2023-07-19 13:38:32 -04:00
HesterG
1f003f6298 translation for blog on navbar and remove target="_blank" for internal links (#44)
- Do not use `target="_blank"`for gitea websites on navbar (same behavior as about.gitea.com)

- Translate "blog" on navbar for zh-cn

Before:

![Screen Shot 2023-07-12 at 17.40.27](/attachments/8c2d2a0d-5b66-4396-a962-9dd5aec20aaa)

After:

![Screen Shot 2023-07-12 at 17.41.47](/attachments/65822b16-9ba9-4452-94b1-f8c145ffd78b)

Reviewed-on: https://gitea.com/gitea/gitea-docusaurus/pulls/44
Co-authored-by: HesterG <hestergong@gmail.com>
Co-committed-by: HesterG <hestergong@gmail.com>
2023-07-12 12:58:44 +00:00
HesterG
2141715f56 update header to make it the same as blog (#43)
Follows https://gitea.com/gitea/blog/pulls/266, should wait for the PR because it has href points to https://blog.gitea.com

PC:

![Screen Shot 2023-07-12 at 08.53.32](/attachments/8742094d-bdca-404a-bd1f-ef34df5af328)

Mobile:

![Screen Shot 2023-07-12 at 08.53.45](/attachments/947785d6-535b-4867-91c6-1a3c465b6fdc)

Reviewed-on: https://gitea.com/gitea/gitea-docusaurus/pulls/43
Co-authored-by: HesterG <hestergong@gmail.com>
Co-committed-by: HesterG <hestergong@gmail.com>
2023-07-12 03:55:43 +00:00
HesterG
d6ee444476 Use custom api dropdown and fix compatibility for firefox (#39)
- Used custom api dropdown for changing label dynamically. Used method discussed in [this post](https://github.com/facebook/docusaurus/pull/7231). `ComponentTypes` is ejected safely.

  ![Screen Shot 2023-07-05 at 16.21.43](/attachments/b4bc8ae4-6a8a-406c-98b7-f739b13c32ba)

- Fixed dropdowns missing on chrome docs page

  ![Screen Shot 2023-07-05 at 16.44.08](/attachments/1e5315b4-a057-4325-990f-1cbc35fb475f)

-  Fixed `:has` selector compatibility problem on firefox. After (Screenshots from firefox):

  ![Screen Shot 2023-07-05 at 16.10.23](/attachments/76475fb6-fd58-42ec-b4be-6a774553a887)

  ![Screen Shot 2023-07-05 at 16.10.35](/attachments/956f623a-afdb-4ab4-8aa2-beb9420727fb)

  ![Screen Shot 2023-07-05 at 16.15.35](/attachments/af840f31-def4-4f72-8340-f29b72a748bd)

  ![Screen Shot 2023-07-05 at 16.09.30](/attachments/42fa2394-962d-4594-8ef3-c594d3c1e777)

Reviewed-on: https://gitea.com/gitea/gitea-docusaurus/pulls/39
Co-authored-by: HesterG <hestergong@gmail.com>
Co-committed-by: HesterG <hestergong@gmail.com>
2023-07-07 09:19:52 +00:00
6543
2086df848a Gitea v1.19.4 got released (#40)
Reviewed-on: https://gitea.com/gitea/gitea-docusaurus/pulls/40
2023-07-05 17:35:59 +00:00
HesterG
04a97d20b1 Add api page (#32)
# Changes

- Added [redocusaurus](https://github.com/rohit-gohri/redocusaurus) package to display swagger api with reference to [woodpecker](https://github.com/woodpecker-ci/woodpecker/tree/master/docs)
- Change `sed` for swagger.json for proper version and baseurl.
- Add a dropdown for different api versions. (screenshot below)
- On API pages, only API version dropdown will show(hide locale dropdown, version dropdown for doc, and doc search)
- Allow build CSR API pages for development so it saves building time.

# Screenshots

![Screen Shot 2023-06-27 at 11.56.59](/attachments/7f43976d-f9f1-42ff-85f5-0bc84e549441)

![Screen Shot 2023-06-27 at 10.58.11](/attachments/bde25da5-b0a6-4908-9c69-c6aed41f8f59)

![Screen Shot 2023-06-21 at 12.26.26](/attachments/84a9bf5a-229b-4031-9654-3bae6cb3301a)

![Screen Shot 2023-06-19 at 16.34.33](/attachments/653b2b59-bc8a-4e6c-82f2-eb9710f55d8d)

Search:

![Screen Shot 2023-06-21 at 14.49.15](/attachments/3a09bd89-36a8-4156-a2df-2d3176d3ddb1)

Reviewed-on: https://gitea.com/gitea/gitea-docusaurus/pulls/32
Co-authored-by: HesterG <hestergong@gmail.com>
Co-committed-by: HesterG <hestergong@gmail.com>
2023-07-05 03:54:54 +00:00
techknowlogick
a6ca489269 Update loop_docs.sh 2023-06-29 18:55:46 +00:00
techknowlogick
4f318d3f85 Update loop_docs.sh 2023-06-29 18:47:46 +00:00
techknowlogick
0a38426175 update docker image tag 2023-06-29 18:37:17 +00:00
techknowlogick
1753d53291 Update loop_docs.sh 2023-06-29 18:34:10 +00:00
techknowlogick
bf0608d795 1.20.0-rc2 2023-06-29 18:33:03 +00:00
techknowlogick
e974138e39 1.20.0-rc2 2023-06-29 18:32:46 +00:00
techknowlogick
18fa94cb73 Add awesome list to docs (#37)
Reviewed-on: https://gitea.com/gitea/gitea-docusaurus/pulls/37
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-committed-by: techknowlogick <techknowlogick@gitea.io>
2023-06-29 18:03:46 +00:00
techknowlogick
eeeab51bbe Update loop_docs.sh 2023-06-23 22:22:30 +00:00
techknowlogick
7ce2b24df0 Update docusaurus.config.js 2023-06-23 22:21:38 +00:00
techknowlogick
f10d6b3658 Update docusaurus.config.js 2023-06-21 05:30:02 +00:00
HesterG
c82e0fcc8d fix sed for MacOS (#36)
Close #4

Right now on MacOS, sed will produce backup files, because on Mac, If do something like below using bash script

```
$SED_INPLACE '1s/---/---\nisOutdated: true/' $file
```

It will become the following on executed, and a backup file will be produced:

```
sed -i ''\'''\''' '1s/---/---\nisOutdated: true/' ./docs/content/doc/help/faq.zh-cn.md
```

The way to fix this in this PR is to change the `SED_INPLACE` to a function. [Reference](aa19c2d125/generate-cpp.sh (L4)) (Tested on my
Mac and backup files with suffix '' will not be produced after changing to function)

Reviewed-on: https://gitea.com/gitea/gitea-docusaurus/pulls/36
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: HesterG <hestergong@gmail.com>
Co-committed-by: HesterG <hestergong@gmail.com>
2023-06-20 14:47:10 +00:00
HesterG
a5d22599e1 fix publish for v1.20 (#33)
Reviewed-on: https://gitea.com/gitea/gitea-docusaurus/pulls/33
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: HesterG <hestergong@gmail.com>
Co-committed-by: HesterG <hestergong@gmail.com>
2023-06-14 07:53:23 +00:00
HesterG
7ca358b43e Add v1.20 documentation (#28)
Modified `loop_docs.sh` to take `version` and `locale` and params so do not need other `loop_docs*` scripts.

Need confirmation with version information for 1.20 and latest.
Like version in `static/20-swagger.json` and `static/latest-swagger.json`, and version used to replace `{{< version >}}`

Will wait for a stable version for 1.20

![Screen Shot 2023-06-14 at 12.12.18](/attachments/1b316978-0daf-46bb-90a7-632a0fc80898)

Reviewed-on: https://gitea.com/gitea/gitea-docusaurus/pulls/28
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: HesterG <hestergong@gmail.com>
Co-committed-by: HesterG <hestergong@gmail.com>
2023-06-14 07:05:13 +00:00
HesterG
9bc53d050e Use mdxa to point to versioned links (#27)
Close #17

mdxa is another component that is safe to eject

![Screen Shot 2023-06-08 at 09.56.29](/attachments/b5af1044-9e3f-4776-91a1-ed6f69e2e3a7)

And right now some links are using `master` as the branch(link will be redirect to `main`), so checked for that as well.

Update:

Change `master` to `main` in upstream, so also removed check for `master`

https://github.com/go-gitea/gitea/pull/25126

# After

For example:

![Screen Shot 2023-06-08 at 09.52.05](/attachments/5033b2ca-b51d-47da-ba20-a420e7613626)

![Screen Shot 2023-06-08 at 09.52.33](/attachments/6e7c75f5-01ab-40b4-a57c-df8edb81f677)

![Screen Shot 2023-06-08 at 09.52.47](/attachments/185eb828-6346-48a9-96cc-2beb6353410c)

![Screen Shot 2023-06-08 at 09.53.50](/attachments/f6c57dc1-d452-47f0-b4fc-f3766008ab57)

Reviewed-on: https://gitea.com/gitea/gitea-docusaurus/pulls/27
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: HesterG <hesterg@noreply.gitea.com>
Co-committed-by: HesterG <hesterg@noreply.gitea.com>
2023-06-09 06:57:18 +00:00
silverwind
9cff3696e2 Add .editorconfig and .gitattributes (#29)
Every repo needs these files 😉

Reviewed-on: https://gitea.com/gitea/gitea-docusaurus/pulls/29
Co-authored-by: silverwind <me@silverwind.io>
Co-committed-by: silverwind <me@silverwind.io>
2023-06-08 18:07:59 +00:00
HesterG
1ba3ac7c99 Add outdated component to outdated documents (#25)
- `git log` needs all commit history to compare latest commit of files, so changed `git clone --depth=1` to `git clone`. This will make the step take longer, so might be improved if there is a better way.

- `src/theme/MDXContent/index.js` is from [ejecting of the component](https://docusaurus.io/docs/swizzling#ejecting) inside `@docusaurus/theme-classic` plugin, and this one is safe to eject according to docusaurus

    ![Screen Shot 2023-06-06 at 12.12.28](/attachments/17a3a84b-cec0-4849-8bd6-9e0471d9536f)

    ![Screen Shot 2023-06-06 at 12.12.15](/attachments/58bba321-3cfb-4a8b-8aeb-84422a06c472)

- [Outdated component style reference](https://mui.com/material-ui/react-alert/)

- Added [`Translate` component](https://docusaurus.io/docs/next/docusaurus-core#translate) to `Outdated` so it can be localized. [reference](https://docusaurus.io/docs/next/i18n/tutorial#translate-your-react-code)

- One way to check for the specific outdated documents:

    search for `lastest commit timestamp` in [prepare nightly docs and prepare 1.19 docs steps](https://gitea.com/gitea/gitea-docusaurus/actions/runs/74)

# After

The Chinese documents that are outdated (latest commit is ealier than laster commit of English version):

![Screen Shot 2023-06-06 at 13.04.24](/attachments/e5d16267-d8d8-434e-89b1-138d04ec92a3)

![Screen Shot 2023-06-06 at 13.05.07](/attachments/af8f996a-5318-4f89-841f-b27a4903a27d)

![Screen Shot 2023-06-06 at 13.05.14](/attachments/e6aba31b-46ba-4a32-ad81-81007e0f711e)

Reviewed-on: https://gitea.com/gitea/gitea-docusaurus/pulls/25
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: HesterG <hestergong@gmail.com>
Co-committed-by: HesterG <hestergong@gmail.com>
2023-06-08 03:34:23 +00:00
jolheiser
d3323cee1c fix: sed incantation for dl.gitea.com main-nightly (#26)
Signed-off-by: jolheiser <john.olheiser@gmail.com>
Reviewed-on: https://gitea.com/gitea/gitea-docusaurus/pulls/26
Reviewed-by: techknowlogick <techknowlogick@noreply.gitea.com>
Co-authored-by: jolheiser <john.olheiser@gmail.com>
Co-committed-by: jolheiser <john.olheiser@gmail.com>
2023-06-06 20:31:45 +00:00
HesterG
817dac0942 Sed for versions information (#24)
Reviewed-on: https://gitea.com/gitea/gitea-docusaurus/pulls/24
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: HesterG <hestergong@gmail.com>
Co-committed-by: HesterG <hestergong@gmail.com>
2023-05-31 05:05:50 +00:00
jolheiser
54ed2879c1 Fix sed incantation for empty (#23)
Follow up for #22

Reviewed-on: https://gitea.com/gitea/gitea-docusaurus/pulls/23
Co-authored-by: jolheiser <john.olheiser@gmail.com>
Co-committed-by: jolheiser <john.olheiser@gmail.com>
2023-05-30 19:10:17 +00:00
jolheiser
d3c11f4363 fix: update sed incantation for empty (#22)
Should resolve #21

I cannot seem to get this to run properly on my machine, however this is an educated guess because the Chinese translation looks correct.

zh-cn
https://docs.gitea.com/zh-cn/administration/config-cheat-sheet#repository---release-repositoryrelease
8c38ae516a/loop_docs-zh-cn.sh (L11)

en-us
https://docs.gitea.com/administration/config-cheat-sheet#repository---release-repositoryrelease
(check diff for current incantation)

Reviewed-on: https://gitea.com/gitea/gitea-docusaurus/pulls/22
Reviewed-by: techknowlogick <techknowlogick@noreply.gitea.com>
Co-authored-by: jolheiser <john.olheiser@gmail.com>
Co-committed-by: jolheiser <john.olheiser@gmail.com>
2023-05-30 17:51:06 +00:00
HesterG
8c38ae516a Fix edit url and announcement bar color on dark mode (#20)
Changes:

1. Dark mdoe colors for announcement bar, used the way in [CSS module class names in the document](https://docusaurus.io/docs/styling-layout#global-styles) to change the style.

2. Fix edit url. Right now, clicking on "edit url" will redirect to lastest version of documents no matter from v1.19 or current version.

Reviewed-on: https://gitea.com/gitea/gitea-docusaurus/pulls/20
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: HesterG <hestergong@gmail.com>
Co-committed-by: HesterG <hestergong@gmail.com>
2023-05-30 09:42:46 +00:00
HesterG
5c13cb18d2 Fix relrefs by following formats allowed by docusaurus (#18)
relrefs from upstream is in the format of `[text]({{< relref "doc/<path under doc>.md" >}})`, for example, `[instructions]({{< relref "doc/installation/from-source.en-us.md" >}})`. In this PR, use bash scripts to remove `{{< relref "doc/`,  `.en-us`/`.zh-cn` and `" >}}` parts so the link can be used by [docusaurus](https://docusaurus.io/docs/markdown-features/links)

Related: https://github.com/go-gitea/gitea/pull/24979, might need to backport this PR into 1.19
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-on: https://gitea.com/gitea/gitea-docusaurus/pulls/18
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: HesterG <hestergong@gmail.com>
Co-committed-by: HesterG <hestergong@gmail.com>
2023-05-29 16:24:40 +00:00
HesterG
c123ee5449 Use capitals for actions and packages (#19)
![Screen Shot 2023-05-29 at 18.18.31](/attachments/1255a8a5-f46f-4e2e-8a43-398a292fff2a)

Reviewed-on: https://gitea.com/gitea/gitea-docusaurus/pulls/19
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: HesterG <hestergong@gmail.com>
Co-committed-by: HesterG <hestergong@gmail.com>
2023-05-29 10:28:05 +00:00
HesterG
c911962cd6 fix typo and some seds for <empty> (#15)
# Before:

![Screen Shot 2023-05-26 at 15.48.12](/attachments/09d9a965-1587-40c9-b81b-e8416ac0c226)![Screen Shot 2023-05-26 at 15.48.17](/attachments/8beda8a1-5c49-4c87-95e7-e4aa95e56ec9)![Screen Shot 2023-05-26 at 15.48.57](/attachments/21dad81e-eed1-4280-bbb4-eeda039bec41)![Screen Shot 2023-05-26 at 16.14.44](/attachments/07a3148a-52ea-43bb-8e07-c0d8f31d1c24)

# After:

![Screen Shot 2023-05-26 at 16.02.38](/attachments/24239f32-6e9a-487c-8532-b6bd22ca6a50)(/attachments/85c184f3-58ca-4616-bb9d-9afacbc59290)![Screen Shot 2023-05-26 at 16.03.02](/attachments/4952880a-3254-4139-8943-ff37a9797bd7)![Screen Shot 2023-05-26 at 16.05.03](/attachments/ef77be92-2c60-4962-8b0a-efeed63a663b)![Screen Shot 2023-05-26 at 16.15.22](/attachments/22ea1d0b-2838-488d-92c7-e2db8e53ebae)

Reviewed-on: https://gitea.com/gitea/gitea-docusaurus/pulls/15
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: HesterG <hestergong@gmail.com>
Co-committed-by: HesterG <hestergong@gmail.com>
2023-05-26 17:49:55 +08:00
HesterG
20c970682b Add Chinese support (#13)
# Main changes and Some notices

- Chines Docs should be put into corresponding versions' folders under `i18n/zh-cn/docusaurus-plugin-content-docs`. See [translate-markdown-files](https://docusaurus.io/docs/i18n/tutorial#translate-markdown-files) for reference. And also [srs-docs](https://github.com/ossrs/srs-docs) is a project that can be used as a reference. So changed the related paths in `loop_docs*` scripts.

- The markdown files under `docs/<version>` and `i18n/zh-cn/docusaurus-plugin-content-docs/<version>` must have the same name to be referred as translated. Files inside docs are corresponding to `current` version.
For example, `docs/administration/mail-templates.md` and `i18n/zh-cn/docusaurus-plugin-content-docs/current/administration/mail-templates.md`.  Filename of `mail-templates.md` must be the same (cannot be `mail-templates.zh-cn.md` and `mail-templates.us-en.md`)
So trim the `.en-us.md` and `.zh-cn.md` to `.md` to ensure the same names inside `loop_docs*` scripts.

- Used `npx docusaurus write-translations --locale zh-cn` to do sidebar, footer, and header translations, so no need to keep `sideBarCN` anymore. [reference](https://docusaurus.io/docs/cli#docusaurus-write-translations-sitedir)

- Local Tests for `en` and `zh-cn` are separeted, run the following on local respectly to test them

    ```bash
    # test en version
    npm run start
    # test zh-cn version
    npm run start -- --locale zh-cn
    ```

- If wants to test `en` and `zh-cn` both at the same time, run build and serve

    ```
    npm run build
    npm run serve
    ```

- Added some indexed page, for example:

![Screen Shot 2023-05-26 at 13.49.34](/attachments/9eeb3d38-c309-457d-9015-053b9c5ca8d6)

![Screen Shot 2023-05-26 at 13.49.49](/attachments/fc348d17-ce4c-4c4d-9240-b69add4ef06e)

Reviewed-on: https://gitea.com/gitea/gitea-docusaurus/pulls/13
Co-authored-by: HesterG <hestergong@gmail.com>
Co-committed-by: HesterG <hestergong@gmail.com>
2023-05-26 14:30:13 +08:00