diff --git a/docs/hosting.md b/docs/hosting.md index 7e50f6c4d..1eb04c821 100644 --- a/docs/hosting.md +++ b/docs/hosting.md @@ -121,6 +121,47 @@ See the [GitHub documentation](https://docs.github.com/en/pages/configuring-a-cu > > Make sure you save your changes to Git and sync it to GitHub by doing `npx quartz sync`. This will also make sure to pull any updates you may have made from other devices so you have them locally. +## GitLab Pages + +> [!note] +> GitLab Pages requires a verified phone number on your GitLab account to deploy pages. + +You can deploy your Quartz site to GitLab Pages using GitLab CI/CD. The pipeline will run on every commit to automatically build and deploy your site. + +### Method 1: Using `.gitlab-ci.yml` + +In your local Quartz, create a new file `.gitlab-ci.yml` in the root directory: + +```yaml title=".gitlab-ci.yml" +# The Docker image that will be used to build your app +image: node:lts +create-pages: + pages: + # The folder that contains the files to be exposed at the Page URL + publish: public + rules: + # This ensures that only pushes to the default branch will trigger + # a pages deploy + - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH + # Functions that should be executed before the build script is run + before_script: + - npm ci + script: + - npx quartz build +``` + +Commit and push this file to your repository. GitLab will automatically detect the configuration and start building and deploying your site. + +### Method 2: Using GitLab UI + +Alternatively, you can set up GitLab Pages through the GitLab interface by following [GitLab's Pages UI setup guide](https://docs.gitlab.com/user/project/pages/getting_started/pages_ui/#create-the-pages-deployment). + +### Configuration Notes + +- If you've modified Quartz's output directory from the default `public` folder, make sure to update the `publish` field in your `.gitlab-ci.yml` to match your custom output directory. +- Your site will be available at `https://.gitlab.io/` once deployed if you've disabled `Use unique domain` in `Deploy > Pages > Domains and settings`. +- The pipeline runs automatically on every commit to your default branch. + ## Vercel ### Fix URLs