2.7 KiB
2.7 KiB
Eco-Life - A Multilingual Static Next.js Project
This project is a statically exported, multilingual website built with Next.js (App Router), Tailwind CSS, and ShadCN/UI. It serves as a showcase for "Eco-Life," a fictional environmental initiative.
Features
- Static Site Generation (SSG): The entire site is statically exported for optimal performance and security. Configured with
output: 'export'. - Multilingual Support (i18n): Fully supports multiple languages through Next.js's App Router i18n capabilities.
- Supported Languages: English (en), Simplified Chinese (zh-CN), Traditional Chinese (zh-TW), Korean (ko), and Japanese (ja).
- Automatic Language Detection: The root of the site automatically detects the user's browser language and redirects to the appropriate language version (e.g.,
/en,/zh-CN). - Dynamic Content: Includes a blog with dynamically generated static pages for each post and language.
- SEO Optimized: Automatically generates
sitemap.xmlandrobots.tsfor better search engine visibility. - Modern Tech Stack: Built with the latest features of Next.js, React Server Components, and Client Components.
Getting Started
Prerequisites
Installation
- Clone the repository:
git clone <repository-url> - Navigate to the project directory:
cd <project-directory> - Install the dependencies:
npm install # or yarn install # or bun install
Running the Development Server
To view the project in development mode with hot-reloading:
npm run dev
# or
yarn dev
# or
bun dev
Open http://localhost:3000 in your browser to see the result.
Building for Production
To build the static site for production:
npm run build
# or
yarn build
# or
bun build
This command will generate a build directory containing all the static files for the website.
Previewing the Static Site
After building, you can preview the local static site by running a simple HTTP server in the build directory. For example, using serve:
# Install serve if you don't have it
npm install -g serve
# Serve the build directory
serve build
This will start a server, and you can view your statically exported site at the provided local URL (e.g., http://localhost:3000).
