A lightweight, multilingual Astro starter template designed for developers to quickly build static websites with support for Polish (PL) and English (EN) languages, SCSS styling, TypeScript, WebP image optimization, and SEO enhancements.
- Multilingual Support (i18n): Built-in internationalization with Polish (
pl) as the default language and English (en) as an additional language, using Astro's i18n routing. - SCSS Styling: Integrated SCSS support for modular and maintainable CSS, compiled via
sass. - WebP Image Optimization: Optimized image handling with
.webpformat using Astro's built-inastro:assetsmodule for fast and modern websites. - SEO Optimization: Enhanced SEO with
astro-seofor Open Graph and Twitter meta tags. - TypeScript: Full TypeScript support for type-safe development.
- Static Assets: Support for static assets in
public/and dynamic assets insrc/assets/.
/
├── public/
│ ├── favicon.svg
│ └── images/
│ └── home-og.jpg
├── src/
│ ├── assets/
│ │ └── astro.svg
│ ├── i18n/
│ │ ├── pl.json
│ │ └── en.json
│ ├── layouts/
│ │ └── Layout.astro
│ ├── pages/
│ │ ├── [locale]/
│ │ │ └── index.astro
│ │ └── index.astro
│ ├── styles/
│ │ └── global.scss
├── astro.config.mjs
├── package.json
└── tsconfig.json
public/: Static assets likefavicon.svgand images for Open Graph (home-og.jpg).src/assets/: Dynamic assets (e.g.,astro.svg) for optimized imports.src/i18n/: JSON files for translations (pl.json,en.json).src/layouts/: Reusable layout component (Layout.astro) with SEO and i18n support.src/pages/: Pages with i18n routing (index.astrofor/,[locale]/index.astrofor/en/).src/styles/: SCSS styles (global.scss).astro.config.mjs: Configures i18n and image optimization.tsconfig.json: TypeScript configuration for type-safe development.
- Node.js (v18 or higher)
- npm (v9 or higher)
- Clone the repository:
git clone https://github.com/gmaxsoft/astro_frame.git cd astro_frame - Install dependencies:
npm install
Run these commands from the project root:
| Command | Action |
|---|---|
npm run dev |
Starts the development server at http://localhost:4321 |
npm run build |
Builds the production site to ./dist/ |
npm run preview |
Previews the built site locally |
npm run astro ... |
Runs Astro CLI commands (e.g., astro check) |
- Development: Run
npm run devto start the server. Access the site at:http://localhost:4321/for Polish (default).http://localhost:4321/en/for English.
- Build: Run
npm run buildto generate static files indist/. - Translations: Add or edit translations in
src/i18n/pl.jsonandsrc/i18n/en.json. - Images: Place static images in
public/images/(e.g.,home-og.jpg) or dynamic images insrc/assets/for optimization with<Image>fromastro:assets. - SCSS: Add styles in
src/styles/global.scssand import in.astrofiles with<style lang="scss">.
The project supports two languages:
- Polish (
pl): Default, accessible at/(e.g.,http://localhost:4321/). - English (
en): Accessible at/en/(e.g.,http://localhost:4321/en/).
To add a new language (e.g., German de):
- Add the language to
astro.config.mjs:i18n: { defaultLocale: 'pl', locales: ['pl', 'en', 'de'] }
- Create
src/i18n/de.jsonwith translations. - Update
src/pages/[locale]/index.astroingetStaticPathsto include{ params: { locale: 'de' } }.
Images (including .webp) are optimized using Astro's built-in astro:assets module:
- Static Images: Place in
public/images/and use<img src="/images/example.webp">. - Dynamic Images: Place in
src/assets/and import:--- import exampleImage from '../assets/example.webp'; import { Image } from 'astro:assets'; --- <Image src={exampleImage} alt="Example" width={800} height={600} />
- Install
sharpfor faster image processing:npm install sharp
- SCSS is supported via the
sasspackage. - Add global styles in
src/styles/global.scssand import in.astrofiles:<style lang="scss"> @import '../styles/global.scss'; </style>
SEO is handled by the astro-seo package, with Open Graph and Twitter meta tags configured in src/layouts/Layout.astro. Update meta tags via props:
<Layout title="Page Title" description="Page Description" ogImage="/images/home-og.jpg">For questions or contributions, open an issue on GitHub or contact the maintainer.