Skip to content

Commit

Permalink
Improve configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaitanLyss committed Aug 7, 2024
1 parent 88b016c commit e1e4c3b
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 24 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SITE_ORIGIN=http://localhost:4444
5 changes: 3 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ on:
types: [created]

env:
SITE_URL: https://selenite-geos.github.io
SITE_BASE: '/docs'
SITE_ORIGIN: https://selenite-geos.github.io
BASE_PATH: '/docs'

jobs:
build:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pnpm-debug.log*


# environment variables
.env
# .env
.env.production

# macOS-specific files
Expand Down
15 changes: 4 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
# Selenite Docs
## Configuration

[![Built with Starlight](https://astro.badg.es/v2/built-with-starlight/tiny.svg)](https://starlight.astro.build)

```
npm create astro@latest -- --template starlight
```

[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/withastro/starlight/tree/main/examples/basics)
[![Open with CodeSandbox](https://assets.codesandbox.io/github/button-edit-lime.svg)](https://codesandbox.io/p/sandbox/github/withastro/starlight/tree/main/examples/basics)
[![Deploy to Netlify](https://www.netlify.com/img/deploy/button.svg)](https://app.netlify.com/start/deploy?repository=https://github.com/withastro/starlight&create_from_path=examples/basics)
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fwithastro%2Fstarlight%2Ftree%2Fmain%2Fexamples%2Fbasics&project-name=my-starlight-docs&repository-name=my-starlight-docs)

> 🧑‍🚀 **Seasoned astronaut?** Delete this file. Have fun!
## Configuration
The build of the documentation can be configured using environment variables. The following variables are available:
- `SITE_ORIGIN`: The origin of the site, used for generating the sitemap. If not set, the sitemap will not be generated.
- `BASE_PATH`: The base path of the site. All routes will be prefixed with this path.

## 🚀 Project Structure

Expand Down
21 changes: 11 additions & 10 deletions astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@ import { defineConfig } from 'astro/config';
import starlight from '@astrojs/starlight';
import { loadEnv } from 'vite';

const { SITE_URL = 'http://localhost:4444', SITE_BASE = '' } = loadEnv(process.env.NODE_ENV, process.cwd(), "");
console.log('SITE_URL', SITE_URL);
if (SITE_BASE !== '')
console.log('SITE_BASE', SITE_BASE);
else
console.log('No site base.')
const { SITE_ORIGIN, BASE_PATH = "/" } = loadEnv(process.env.NODE_ENV, process.cwd(), "");
if (SITE_ORIGIN)
console.log('SITE_ORIGIN', SITE_ORIGIN);
else
console.warn('SITE_ORIGIN is not specified. A sitemap will not be generated.');
console.log('BASE_PATH', BASE_PATH);


// https://astro.build/config
export default defineConfig({
site: SITE_URL,
base: SITE_BASE,
site: SITE_ORIGIN,
base: BASE_PATH,
trailingSlash: 'never',
integrations: [
starlight({
Expand Down Expand Up @@ -44,10 +45,10 @@ export default defineConfig({
},
{
label: 'Developper',
autogenerate: { directory: 'developper' },
autogenerate: { directory: 'developper' },
translations: {
fr: 'Développeur',
},
},
},
{
label: 'Reference',
Expand Down

0 comments on commit e1e4c3b

Please sign in to comment.