English | 简体中文
The website of an NSGo project as one Astro integration: a home page, bilingual docs, a roadmap from GitHub issues and the shared header and footer, all from the project's own settings.
The package ships its TypeScript and Astro sources and needs Astro 7 and Bun. Add it to the project's site folder from GitHub:
bun add astro github:nsgo-dev/nsgo-websiteA site is three small files. site.config.ts holds the settings:
import { defineSite } from 'nsgo-website/config';
export default defineSite({
name: 'NSGo Pet',
title: { en: 'NSGo Pet: a desktop pet', zh: 'NSGo Pet:桌面宠物' },
description: 'A desktop pet built with NSGo.',
logo: './src/assets/logo.png',
repo: 'https://github.com/oneo-me/nsgo-pet',
docs: { sidebar: [{ label: { en: 'Start', zh: '开始' }, items: ['docs', 'docs/quick-start'] }] },
roadmap: { tracking: 2 },
home: {
headline: { en: ['A desktop pet', 'for everyone.'], zh: ['桌面宠物,', '人人都能养。'] },
lead: 'It lives on your desktop.',
sections: [{ type: 'features', id: 'features', title: 'Features', items: [{ icon: 'heart', title: 'Cute', text: 'Very.' }] }],
},
});astro.config.mjs hands them to the integration, and src/content.config.ts declares the docs:
import { defineConfig } from 'astro/config';
import nsgoWebsite from 'nsgo-website';
import site from './site.config.ts';
export default defineConfig({ site: 'https://oneo-me.github.io', base: '/nsgo-pet', integrations: [nsgoWebsite(site)] });import { docsCollection } from 'nsgo-website/content';
export const collections = { docs: docsCollection() };languages picks the site's languages, English and Chinese unless set: any of en, zh, zh-tw, ja, ko, es, fr, de, pt, ru, it, vi, id and tr, whose header, footer and roadmap words the package has. The first is served at the root and each other under its code. Any text, list or section may be one value for every language or one per language, as { en, zh }; a language left out takes the first's. The docs are Markdown in one folder per language code, under ../docs/public by default. src/config.ts documents every setting.
look: 'demoscene' dresses the whole site as real-time computer art for game engines and games: amber on black in the dark theme, NSGo's blue on white in the light, monospaced type, square corners, few lines and no glow or gradient. Its home page is the project's own, built from Effects, Effect, Ticker, Demo and Parallax in nsgo-website/components: Demo draws classic effects (a knot the reader can drag, plasma, a tunnel, terrain, stars and more) in real time, dithered in the theme's accent; logoDark gives a logo for the dark theme. example-game/ is a template to copy.
sponsors adds a sponsors page, linked last in the header's navigation (nav may place it elsewhere) and at the footer's end, of the project's own tiers, each with its title and a layout: featured cards, large or small logos, service for a logo with what a company gives instead of money (such as CI), avatar or name. maintainers puts the people readers sponsor atop the page as cards, as GitHub Sponsors does. home puts a tier on the home page too, and places invites sponsors to its open places; a full tier keeps its sponsors, shows them all and only warns at build.
The footer links the project's license, MIT unless footer.license names another. An agent setting up a site must give there the license in the project's own repository, never one the project does not use.
To change more than the settings allow:
- Home page: give
home.visualor acomponentsection an.astrofile of the project's, or sethome: falseand writesrc/pages/index.astroandsrc/pages/<code>/index.astrofromHomePageor the section components. - Own pages: wrap any content in
Pagefromnsgo-website/componentsundersrc/pages/andsrc/pages/<code>/, and list it innavbeside the package's own links. - Colors and words:
customCssoverrides the variables oftokens.css,stringsthe header's and footer's words, andstarlightany Starlight setting.
nsgo-website-share-cards draws public/share/<code>.png, the images of shared links, from the settings; it needs Chrome.
example/ is a complete site, this repository's own, describing a made-up app with sample docs; example-game/ is a made-up game engine's in the demoscene look.
bun install
bun test # the settings' defaults
bun run check # types of the package and both examples
bun run build # builds both examples into their dist
bun run dev # serves the example
bun run dev:game # serves the game engine templateA project's dev script runs astro dev --ignore-lock, as Astro otherwise moves its server to the background when an AI agent starts it. The roadmap reads GitHub with GITHUB_TOKEN or the GitHub CLI's sign-in; a build without either leaves it out, and a tracking issue that does not exist hides it with its links. See ARCHITECTURE.md and AGENTS.md. Changes are in CHANGELOG.md.
© nsgo-dev. The source is published for reading only; see LICENSE.