|
| Framework Preset | Other |
| Root Directory | ./ |
| Build and Output Settings > Build Command | npx quartz build |
*.vercel.app URLs to view the page.[!note] If there is something already hosted on the domain, these steps will not work without replacing the previous content. As a workaround, you could use Next.js rewrites or use the next section to create a subdomain.
baseUrl in quartz.config.js if necessary.Using docs.example.com is an example of a subdomain. They’re a simple way of connecting multiple deployments to one domain.
baseUrl in quartz.config.js if necessary.npx quartz build.public.*.netlify.app URL to view the page.In your local Quartz, create a new file .gitlab-ci.yml.
stages:
- build
- deploy
image: node:22
cache: # Cache modules in between jobs
key: $CI_COMMIT_REF_SLUG
paths:
- .npm/
build:
stage: build
rules:
- if: '$CI_COMMIT_REF_NAME == "v4"'
before_script:
- hash -r
- npm ci --cache .npm --prefer-offline
script:
- npx quartz build
artifacts:
paths:
- public
tags:
- gitlab-org-docker
pages:
stage: deploy
rules:
- if: '$CI_COMMIT_REF_NAME == "v4"'
script:
- echo "Deploying to GitLab Pages..."
artifacts:
paths:
- public
When .gitlab-ci.yaml is committed, GitLab will build and deploy the website as a GitLab Page. You can find the url under Deploy > Pages in the sidebar.
By default, the page is private and only visible when logged in to a GitLab account with access to the repository but can be opened in the settings under Deploy -> Pages.
Copy the public directory to your web server and configure it to serve the files. You can use any web server to host your site. Since Quartz generates links that do not include the .html extension, you need to let your web server know how to deal with it.
Here’s an example of how to do this with Nginx:
server {
listen 80;
server_name example.com;
root /path/to/quartz/public;
index index.html;
error_page 404 /404.html;
location / {
try_files $uri $uri.html $uri/ =404;
}
}
Here’s an example of how to do this with Apache:
RewriteEngine On
ErrorDocument 404 /404.html
# Rewrite rule for .html extension removal (with directory check)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_URI}.html -f
RewriteRule ^(.*)$ $1.html [L]
# Handle directory requests explicitly
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.*)/$ $1/index.html [L]
Don’t forget to activate brotli / gzip compression.
Here’s and example of how to do this with Caddy:
example.com {
root * /path/to/quartz/public
try_files {path} {path}.html {path}/ =404
file_server
encode gzip
handle_errors {
rewrite * /{err.status_code}.html
file_server
}
}