This project is build with:
- Astro - https://docs.astro.build
- Astro Starlight Theme - https://starlight.astro.build
We have next project structure:
.
βββ public/
βββ src/
β βββ assets/
| βββ components/
β βββ content/
β β βββ docs/
β β βββ config.ts
| βββ styles/
β βββ utils/
β βββ env.d.ts
βββ astro.config.mjs
βββ package.json
βββ tsconfig.json
We are looking for .md
or .mdx
files in the src/content/docs/
directory. Each file is exposed as a route based on its file name.
Images can be added to src/assets/
and embedded in Markdown with a relative link.
Static assets, like favicons, can be placed in the public/
directory.
All commands are run from the root of the project, from a terminal:
Command | Action |
---|---|
npm install |
Installs dependencies |
npm run dev |
Starts local dev server at localhost:3000 |
npm run build |
Build your production site to ./dist/ |
npm run preview |
Preview your build locally, before deploying |
npm run astro ... |
Run CLI commands like astro add , astro check |
npm run astro -- --help |
Get help using the Astro CLI |
Please follow next steps to add a new page:
- Create a new file in
src/content/docs/
directory with.md
or.mdx
extension. Put it in thespa
,utilities
orresources
folder, or create a new one if needed. Documents added to thespa
,utilities
orresources
folder would automatically appear in the sidenav. If you want to add a new section to the sidenav, please updatesidebar
field config in theastro.config.mjs
. Check docs for more details: https://starlight.astro.build/reference/configuration/#sidebar. - Add a static markdown content to the file(for
.md
), or add dynamic content resolution(for.mdx
). Please check section Fetching Gitlab Content section for more details
Please use next template inside your .mdx
file to fetch content from the Gitlab:
---
title: History Logs SPA
description: Documentation for Versions&Proofs SPA
---
import ContentResolver from '../../../components/content-resolver.astro';
<ContentResolver projectId='PUT_PROJECT_ID' />
This code fetches Readme.md
file from the Gitlab API by the project id and renders it as a markdown content. This is done during build time and it uses GITLAB_TOKEN
env variable.
By default we are looking for the main
branch. But you can specify another branch by adding branch
prop to the ContentResolver
component:
<ContentResolver projectId='PUT_PROJECT_ID' branch='master' />
Please add GITLAB_TOKEN
variable to the:
.env
file for local development- CI environment variables for the production CI pipeline