Before you begin, make sure you have Node.js
and yarn
installed.
# Install dependencies
yarn
# Generate `zh` and `en` pages
yarn localize
# Run the website locally at http://localhost:3000
yarn dev
This project follows a specific structure, and all news content is stored in the src/content/news
directory. To add a news article, follow these steps:
-
Copy the
template-1.mdx
file insrc/content/news/template
./ └── src/ └── content/ └── news/ └── template/ └── template-1.mdx
-
Modify the template to create Chinese and English version of the news.
-
Paste the copied file into the
en/
directory for the English version and thezh/
directory for the Chinese version. If you want the news article to appear on both the English and Chinese sites, place it in thecommon/
directory./ └── src/ └── content/ └── news/ ├── template/ | └── template-1.mdx ├── common/ | └── (Files in this directory will be visible on both the English and Chinese websites) ├── en/ | └── news-1.mdx (English version of the news) └── zh/ └── news-1.mdx (Chinese version of the news)
To deploy to the nvcenter machine, run the following command:
yarn deploy
That's it! You're done.
If you prefer to do it manually, follow these steps:
# Install dependencies
yarn
# Generate `zh` and `en` pages
yarn localize
# Build your production site to ./dist/
yarn build
After running the build command, your site will be generated in the ./dist/ folder. To deploy your site, simply copy the contents of this folder to your desired deployment location.
All commands are run from the root of the project, from a terminal:
Command | Action |
---|---|
yarn install |
Installs dependencies |
yarn dev |
Starts local dev server at localhost:3000 |
yarn build |
Build your production site to ./dist/ |
yarn localize |
Generate zh and en pages |
yarn deploy |
Run the ecosystem config with pm2 |
For further inquiries or additional information, please contact Ethan-Chiu at ethanchiu0608@gmail.com.