The official Astro starter theme for Static Website Generator (SWG).
Build fast, modern static websites using Astro, JSON content and reusable themes.
Clone the repository:
git clone https://github.com/nxtgencoders/swg-theme.gitInstall dependencies:
npm installValidate the theme:
npm run validateStart the development server:
npm run devBuild the project:
npm run buildCreate a distributable theme package:
npm run packageThe demo website is available at:
http://localhost:4321
Continue reading below for the complete project structure and documentation.
- Astro
- Theme specification compliant
- Reusable layouts
- Reusable templates
- Demo content
- Ready for SWG import
- Node.js 20+
- npm
The SWG Theme Starter follows a standardized directory structure.
swg-theme/
├── public/
├── src/
│ ├── assets/
│ ├── components/
│ ├── layouts/
│ ├── pages/
│ ├── styles/
│ └── templates/
│
├── astro.config.mjs
├── package.json
├── theme.json
├── tsconfig.json
└── README.md
Static files such as:
- images
- icons
- favicon
- fonts
Required
Theme assets used during the Astro build.
Examples:
- images
- illustrations
- svg files
Optional
Reusable Astro components.
Examples:
- Header
- Footer
- Hero
- Button
- Card
Required
Shared page layouts.
Every SWG Theme must provide:
BaseLayout.astro
Required
The Astro entry points used during local theme development.
These files allow the theme to run as a standalone Astro project using:
npm run devand
npm run buildDuring the SWG Theme import process, the original src/pages/ directory is not imported.
Instead, SWG installs its own standardized pages that provide the official routing for:
- Homepage
- Pages
- Blog
- Documentation
- Search
- 404
- RSS (optional)
- Sitemap (optional)
This guarantees that every imported theme shares the same routing and build pipeline.
Required for local development
Replaced during SWG import
Global stylesheets.
Examples:
base.css
theme.css
Optional
Templates render SWG content.
Examples:
Homepage.astro
Page.astro
BlogIndex.astro
BlogCategory.astro
BlogArticle.astro
DocsIndex.astro
DocsCategory.astro
DocsArticle.astro
Required
Astro configuration.
Required
Node dependencies and scripts.
Required
SWG Theme metadata.
Required
TypeScript configuration.
Required
Theme documentation.
Highly recommended.
The following files are required by every SWG Theme.
astro.config.mjs
package.json
theme.json
src/layouts/BaseLayout.astro
src/templates/Homepage.astro
src/templates/Page.astro
src/templates/BlogIndex.astro
src/templates/BlogCategory.astro
src/templates/BlogArticle.astro
src/templates/DocsIndex.astro
src/templates/DocsCategory.astro
src/templates/DocsArticle.astro
src/assets/
src/styles/
public/
These directories may be omitted if not used by the theme.
Install the dependencies:
npm installStart the development server:
npm run devIf you are working on a remote server:
npm run dev -- --hostor use an SSH tunnel:
ssh -L 4321:localhost:4321 user@serverOpen:
http://localhost:4321
npm run buildMIT
