From 32f392637c672106b6b7740e606b147e015e41f9 Mon Sep 17 00:00:00 2001 From: spaenleh Date: Wed, 5 Feb 2025 08:17:44 +0100 Subject: [PATCH] fix: add docs and fix umami --- .env | 2 ++ README.md | 43 ++++++++++++++++++++++++------------------- docusaurus.config.js | 3 ++- package.json | 1 + yarn.lock | 8 ++++++++ 5 files changed, 37 insertions(+), 20 deletions(-) create mode 100644 .env diff --git a/.env b/.env new file mode 100644 index 00000000..0aa438dd --- /dev/null +++ b/.env @@ -0,0 +1,2 @@ +UMAMI_WEBSITE_ID=3f9eb1f6-5f5f-4a28-87a5-312829f1446d +BASE="/" diff --git a/README.md b/README.md index aaba2fa1..888286c1 100644 --- a/README.md +++ b/README.md @@ -1,41 +1,46 @@ -# Website +# Graasp Documentation and news + +This repo hosts the code for the Graasp documentation and news website. This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator. ### Installation -``` -$ yarn +```sh +yarn ``` ### Local Development +Create a `.env` file to store your environment variables: + +```dotenv +# required Id for website analytics, locally you can set this to whatever +UMAMI_WEBSITE_ID=3f9eb1f6-5f5f-4a28-87a5-312829f1446d + +# Base url where you will host the website, locally you can change it to `/` so you can serve the static content using static web server +# Or to mimic the production deployment you can omit it. +BASE="/" ``` -$ yarn start + +```sh +yarn start ``` This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server. +> [!WARNING] +> If you want to locally develop one of the internationalisations you will have to start the app with the correct local: +> `yarn start --locale fr` This is because the locales are different SPAs. + ### Build -``` -$ yarn build +```sh +yarn build ``` This command generates static content into the `build` directory and can be served using any static contents hosting service. ### Deployment -Using SSH: - -``` -$ USE_SSH=true yarn deploy -``` - -Not using SSH: - -``` -$ GIT_USER= yarn deploy -``` - -If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch. +This repo deploys the website using GitHub Actions to deploy to GitHub Pages. diff --git a/docusaurus.config.js b/docusaurus.config.js index d85de58f..2dbef035 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -1,6 +1,7 @@ // @ts-check // Note: type annotations allow type checking and IDEs autocompletion import { themes } from "prism-react-renderer"; +import "dotenv/config"; /** @type {import('@docusaurus/types').Config} */ const config = { @@ -203,7 +204,7 @@ const config = { websiteID: process.env.UMAMI_WEBSITE_ID, // Required analyticsDomain: "umami.graasp.org", // Required // scriptName: "", // Optional - dataHostURL: "umami.graasp.org", // Optional + dataHostURL: "https://umami.graasp.org", // Optional dataAutoTrack: true, // Optional dataDoNotTrack: true, // Optional dataCache: true, // Optional diff --git a/package.json b/package.json index 7b573870..868b7c54 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "@mdx-js/react": "^3.1.0", "autoprefixer": "^10.4.20", "clsx": "^2.1.1", + "dotenv": "^16.4.7", "postcss": "^8.4.47", "prism-react-renderer": "^2.4.0", "react": "^18.3.1", diff --git a/yarn.lock b/yarn.lock index 6ea2fe49..2c75cbb2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8432,6 +8432,7 @@ __metadata: "@tsconfig/docusaurus": "npm:^2.0.3" autoprefixer: "npm:^10.4.20" clsx: "npm:^2.1.1" + dotenv: "npm:^16.4.7" postcss: "npm:^8.4.47" prism-react-renderer: "npm:^2.4.0" react: "npm:^18.3.1" @@ -8545,6 +8546,13 @@ __metadata: languageName: node linkType: hard +"dotenv@npm:^16.4.7": + version: 16.4.7 + resolution: "dotenv@npm:16.4.7" + checksum: 10/f13bfe97db88f0df4ec505eeffb8925ec51f2d56a3d0b6d916964d8b4af494e6fb1633ba5d09089b552e77ab2a25de58d70259b2c5ed45ec148221835fc99a0c + languageName: node + linkType: hard + "duplexer@npm:^0.1.2": version: 0.1.2 resolution: "duplexer@npm:0.1.2"