debian-mirror-gitlab/doc/user/project/pages/getting_started_part_one.md

119 lines
5.2 KiB
Markdown
Raw Normal View History

2018-03-27 19:54:05 +05:30
---
2020-05-24 23:13:21 +05:30
stage: Release
2021-02-22 17:27:13 +05:30
group: Release
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
2018-03-27 19:54:05 +05:30
---
2021-09-04 01:27:46 +05:30
# GitLab Pages domain names, URLs, and base URLs **(FREE)**
2018-03-27 19:54:05 +05:30
2019-12-21 20:55:43 +05:30
On this document, learn how to name your project for GitLab Pages
2019-07-31 22:56:46 +05:30
according to your intended website's URL.
2017-08-17 22:00:37 +05:30
2019-12-26 22:10:19 +05:30
## GitLab Pages default domain names
2017-08-17 22:00:37 +05:30
2021-01-03 14:25:43 +05:30
If you use your own GitLab instance to deploy your site with GitLab Pages, verify your Pages
wildcard domain with your sysadmin. This guide is valid for any GitLab instance, provided that you
replace the Pages wildcard domain on GitLab.com (`*.gitlab.io`) with your own.
2017-08-17 22:00:37 +05:30
2019-07-31 22:56:46 +05:30
If you set up a GitLab Pages project on GitLab,
2021-03-08 18:12:59 +05:30
it's automatically accessible under a
2019-07-31 22:56:46 +05:30
subdomain of `namespace.example.io`.
The [`namespace`](../../group/index.md#namespaces)
is defined by your username on GitLab.com,
or the group name you created this project under.
For GitLab self-managed instances, replace `example.io`
with your instance's Pages domain. For GitLab.com,
Pages domains are `*.gitlab.io`.
| Type of GitLab Pages | The name of the project created in GitLab | Website URL |
| -------------------- | ------------ | ----------- |
| User pages | `username.example.io` | `http(s)://username.example.io` |
| Group pages | `groupname.example.io` | `http(s)://groupname.example.io` |
| Project pages owned by a user | `projectname` | `http(s)://username.example.io/projectname` |
| Project pages owned by a group | `projectname` | `http(s)://groupname.example.io/projectname`|
| Project pages owned by a subgroup | `subgroup/projectname` | `http(s)://groupname.example.io/subgroup/projectname`|
2021-02-22 17:27:13 +05:30
WARNING:
2019-07-31 22:56:46 +05:30
There are some known [limitations](introduction.md#limitations)
regarding namespaces served under the general domain name and HTTPS.
Make sure to read that section.
2018-03-17 18:26:18 +05:30
2019-07-31 22:56:46 +05:30
To understand Pages domains clearly, read the examples below.
2017-08-17 22:00:37 +05:30
2019-07-31 22:56:46 +05:30
### Project website examples
2017-08-17 22:00:37 +05:30
- You created a project called `blog` under your username `john`,
2019-07-07 11:18:12 +05:30
therefore your project URL is `https://gitlab.com/john/blog/`.
Once you enable GitLab Pages for this project, and build your site,
2021-03-08 18:12:59 +05:30
you can access it at `https://john.gitlab.io/blog/`.
2017-08-17 22:00:37 +05:30
- You created a group for all your websites called `websites`,
2019-07-07 11:18:12 +05:30
and a project within this group is called `blog`. Your project
URL is `https://gitlab.com/websites/blog/`. Once you enable
2021-03-08 18:12:59 +05:30
GitLab Pages for this project, the site is available at
2019-07-07 11:18:12 +05:30
`https://websites.gitlab.io/blog/`.
2019-03-02 22:35:43 +05:30
- You created a group for your engineering department called `engineering`,
2019-07-07 11:18:12 +05:30
a subgroup for all your documentation websites called `docs`,
and a project within this subgroup is called `workflows`. Your project
URL is `https://gitlab.com/engineering/docs/workflows/`. Once you enable
2021-03-08 18:12:59 +05:30
GitLab Pages for this project, the site is available at
2019-07-07 11:18:12 +05:30
`https://engineering.gitlab.io/docs/workflows`.
2017-08-17 22:00:37 +05:30
2019-07-31 22:56:46 +05:30
### User and Group website examples
2017-08-17 22:00:37 +05:30
- Under your username, `john`, you created a project called
2021-03-08 18:12:59 +05:30
`john.gitlab.io`. Your project URL is `https://gitlab.com/john/john.gitlab.io`.
2019-07-07 11:18:12 +05:30
Once you enable GitLab Pages for your project, your website
2021-03-08 18:12:59 +05:30
is published under `https://john.gitlab.io`.
2017-08-17 22:00:37 +05:30
- Under your group `websites`, you created a project called
2021-03-08 18:12:59 +05:30
`websites.gitlab.io`. Your project's URL is `https://gitlab.com/websites/websites.gitlab.io`.
2019-07-07 11:18:12 +05:30
Once you enable GitLab Pages for your project,
2021-03-08 18:12:59 +05:30
your website is published under `https://websites.gitlab.io`.
2017-08-17 22:00:37 +05:30
**General example:**
2021-03-08 18:12:59 +05:30
- On GitLab.com, a project site is always available under
2019-07-07 11:18:12 +05:30
`https://namespace.gitlab.io/project-name`
2021-03-08 18:12:59 +05:30
- On GitLab.com, a user or group website is available under
2019-07-07 11:18:12 +05:30
`https://namespace.gitlab.io/`
2017-08-17 22:00:37 +05:30
- On your GitLab instance, replace `gitlab.io` above with your
2019-07-07 11:18:12 +05:30
Pages server domain. Ask your sysadmin for this information.
2017-08-17 22:00:37 +05:30
2021-03-11 19:13:27 +05:30
## URLs and base URLs
2019-12-26 22:10:19 +05:30
2021-02-22 17:27:13 +05:30
NOTE:
2021-04-29 21:17:54 +05:30
The `baseurl` option might be named differently in some static site generators.
2021-02-22 17:27:13 +05:30
2019-12-26 22:10:19 +05:30
Every Static Site Generator (SSG) default configuration expects
to find your website under a (sub)domain (`example.com`), not
in a subdirectory of that domain (`example.com/subdir`). Therefore,
whenever you publish a project website (`namespace.gitlab.io/project-name`),
2021-03-08 18:12:59 +05:30
you must look for this configuration (base URL) on your SSG's
2019-12-26 22:10:19 +05:30
documentation and set it up to reflect this pattern.
For example, for a Jekyll site, the `baseurl` is defined in the Jekyll
configuration file, `_config.yml`. If your website URL is
`https://john.gitlab.io/blog/`, you need to add this line to `_config.yml`:
```yaml
baseurl: "/blog"
```
On the contrary, if you deploy your website after forking one of
2021-03-08 18:12:59 +05:30
our [default examples](https://gitlab.com/pages), the `baseurl` is
already configured this way, as all examples there are project
websites. If you decide to make yours a user or group website, you
must remove this configuration from your project. For the Jekyll
example we just mentioned, you must change Jekyll's `_config.yml` to:
2019-12-26 22:10:19 +05:30
```yaml
baseurl: ""
```
2019-07-31 22:56:46 +05:30
2021-02-22 17:27:13 +05:30
If you're using the [plain HTML example](https://gitlab.com/pages/plain-html),
you don't need to set a `baseurl`.
2019-12-26 22:10:19 +05:30
## Custom domains
2019-07-31 22:56:46 +05:30
2019-12-26 22:10:19 +05:30
GitLab Pages supports custom domains and subdomains, served under HTTP or HTTPS.
See [GitLab Pages custom domains and SSL/TLS Certificates](custom_domains_ssl_tls_certification/index.md) for more information.