yew/website
Siyuan Yan b0d0656261
docs: synchronize #3555 0.21 changes to Next (#3834)
2025-03-26 23:04:57 +09:00
..
blog Bump the website-deps group across 1 directory with 15 updates (#3798) 2025-02-21 07:33:40 +09:00
community Bump the website-deps group across 1 directory with 15 updates (#3798) 2025-02-21 07:33:40 +09:00
docs docs: synchronize #3555 0.21 changes to Next (#3834) 2025-03-26 23:04:57 +09:00
i18n docs: update tutorial placeholder image generator. (#3830) 2025-03-25 13:25:23 +09:00
sidebars Prepare for 0.21 release (#3412) 2023-09-29 19:10:07 +09:00
src refactor(NavbarItem): improve readability and maintainability (#3763) 2025-03-15 15:02:01 +09:00
static Use SVG for logo on website (#3065) 2022-12-30 17:37:10 +05:00
versioned_docs [Website] Grammar edit on wasm-bindgen.mdx (#3555) 2025-03-26 22:55:42 +09:00
versioned_sidebars Prepare for 0.22 release (#3750) 2024-12-17 16:27:02 +08:00
.gitignore Docusaurus v2 (#1872) 2021-05-26 22:32:07 +02:00
.prettierignore Format website with prettier (#2536) 2022-04-06 22:52:15 +05:00
.prettierrc.json Format website with prettier (#2536) 2022-04-06 22:52:15 +05:00
README.md Fix links and add CI checks in documentation (#2595) 2022-04-10 21:01:18 +00:00
babel.config.js Format website with prettier (#2536) 2022-04-06 22:52:15 +05:00
check-translations.js Fix links and add CI checks in documentation (#2595) 2022-04-10 21:01:18 +00:00
docusaurus.config.js Fix website search (#3522) 2023-11-08 22:46:50 +09:00
mdx-jetbrains.jpg Incorporate in-code translation in the workflow (#2349) 2022-01-12 18:23:30 +05:00
package-lock.json Bump cross-spawn from 7.0.3 to 7.0.6 in /website (#3766) 2025-03-15 19:16:26 +09:00
package.json Bump the website-deps group across 1 directory with 15 updates (#3798) 2025-02-21 07:33:40 +09:00
tsconfig.json Update to Docusaurus v3 (#3518) 2023-11-05 17:27:39 +05:00
versions.json Prepare for 0.21 release (#3412) 2023-09-29 19:10:07 +09:00
write-translations.js Format website with prettier (#2536) 2022-04-06 22:52:15 +05:00

README.md

Website

This website is built using Docusaurus 2, a modern static website generator.

Most of the content sits inside the docs folder and the versioned_docs folder in the form of markdown.

Installation

npm install

Local Development

npm start

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server. Note this only builds for English locale unlike a production build.

Documentation is written in mdx, a superset of markdown empowered with jsx. JetBrains and VSCode both provide MDX plugins.

Production Build

npm run build

This command generates static content into the build directory and can be served using any static contents hosting service.

Localization

Localization is done on GitLocalize. You can sign in with your GitHub account to start translating.

When you add to the docs in the mdx files,
Contributors on GitLocalize will translate the added content and the translation will get dumped under the i18n folder in a later time.

If you are a native speaker of one of the translated languages, and you are interested in translating your edits yourself, you are welcome to navigate to the folder and do it yourself!

Localizing headings

If you want to write displayed content in html/jsx instead of vanilla markdown, You should wrap your text in <Translate/> tags. It helps docusaurus to extract those texts and compile them to .json files to get further translated in GitLocalize.

import Translate from '@docusaurus/Translate'

<h2>
    <Translate id="header.translation.id" description="the heading description">
        This heading will be translated
    </Translate>
</h2>

If your pull request adds new <Translation> tags, make sure you do npm run write-translations to generate the new stubs for later localization. And you are always welcome to add localization yourself in your native languages!

Common issues in localization

Pages (.mdx) are translated one-to-one and the english text is used as fallback if no translation exists. Sometimes, when building you might see a warning, and subsequent error, like this

[WARNING] Docs markdown link couldn't be resolved: (../components/refs.mdx) in /yew/website/versioned_docs/version-0.18.0/concepts/html/events.mdx for version 0.18.0

This means that the non-translated page at versioned_docs/version-0.18.0/concepts/html/events.mdx contains a relative link - ../components/refs.mdx - to a page that has been translated. Change the link to be relative to the doc root folder, in this case concepts/components/res.mdx, or, if you find the time, also translate the offending page.