Example [Docusaurus] website using GitLab Pages.
Learn more about GitLab Pages at https://about.gitlab.com/features/pages and the official documentation https://docs.gitlab.com/ee/user/project/pages/.
GitLab CI/CD
This project's static Pages are built by GitLab CI/CD,
following the steps defined in .gitlab-ci.yml
:
image: node:9.11.1
pages:
script:
- cd website
- yarn install
- yarn build
# The build directory is created based on the value set for projectName in
# website/siteConfig.js. If you change it there, you need to change it here
# as well.
- mv ./build/docusaurus ../public
artifacts:
paths:
- public
only:
- master
Building locally
To work locally with this project, you'll have to follow the steps below:
-
Fork, clone or download this project.
-
Install Docusaurus:
cd website yarn install
-
Preview your project:
yarn start
Your site can be accessed under http://localhost:3000.
-
Add content.
-
Generate the website (optional):
yarn build
The build directory is created based on the value set for
projectName
inwebsite/siteConfig.js
. If you didn't change this value, the website will be built underwebsite/build/docusaurus/
.
Read more at the Docusaurus documentation.
GitLab User or Group Pages
If you have forked this project, in order to use it as your user/group website served on the root path, you will need to:
- Change the path of your project to
namespace.gitlab.io
, wherenamespace
is yourusername
orgroupname
. This can be done by navigating to your project's Settings > General page under the Advanced section. - Open
website/siteConfig.js
and change:- The
url
to behttps://namespace.gitlab.io
or your custom domain of choice. - The
baseUrl
to be an empty string.
- The
If you have forked this project, and want to use it under a subpath, you will need to:
- Open
website/siteConfig.js
and change:- The
url
to behttps://namespace.gitlab.io
or your custom domain of choice. - The
baseUrl
to be the same as the name of your project.
- The
Read more about the types of GitLab Pages.
Did you fork this project?
If you forked this project for your own use, please go to your project's Settings > General > Advanced and remove the forking relationship, which won't be necessary unless you want to contribute back to the GitLab upstream project.
Troubleshooting
-
CSS is missing! That means two things:
Either that you have wrongly set up the CSS URL in your templates, or your static generator has a configuration option that needs to be explicitly set in order to serve static assets under a relative URL.