2018-02-16 18:01:35 +00:00
---
2018-02-20 14:57:36 +00:00
last_updated: 2018-02-16
2018-02-16 18:01:35 +00:00
author: Marcia Ramos
author_gitlab: marcia
level: beginner
article_type: user guide
date: 2017-02-22
---
2017-02-28 12:21:30 +00:00
2018-02-20 14:57:36 +00:00
# Static sites and GitLab Pages domains
2017-03-16 20:24:35 +00:00
2018-02-20 14:57:36 +00:00
This document is the beginning of a comprehensive guide, made for those who want to
2017-02-28 12:21:30 +00:00
publish a website with GitLab Pages but aren't familiar with
the entire process involved.
2018-02-20 14:57:36 +00:00
This [first document ](#what-you-need-to-know-before-getting-started ) of this series will present you to the concepts of
2017-02-24 22:33:51 +00:00
static sites, and go over how the default Pages domains work.
2018-02-20 14:57:36 +00:00
The [second document ](getting_started_part_two.md ) covers how to get started with GitLab Pages: deploy
2017-02-24 22:33:51 +00:00
a website from a forked project or create a new one from scratch.
2018-02-20 14:57:36 +00:00
The [third document ](getting_started_part_three.md ) will show you how to set up a custom domain or subdomain
2017-02-24 22:33:51 +00:00
to your site already deployed.
2018-02-20 14:57:36 +00:00
The [fourth document ](getting_started_part_four.md ) will show you how to create and tweak GitLab CI for
2017-02-24 22:33:51 +00:00
GitLab Pages.
2017-02-28 12:21:30 +00:00
To **enable** GitLab Pages for GitLab CE (Community Edition)
and GitLab EE (Enterprise Edition), please read the
[admin documentation ](https://docs.gitlab.com/ce/administration/pages/index.html ),
and/or watch this [video tutorial ](https://youtu.be/dD8c7WNcc6s ).
>**Note:**
For this guide, we assume you already have GitLab Pages
server up and running for your GitLab instance.
## What you need to know before getting started
Before we begin, let's understand a few concepts first.
2017-07-16 16:01:11 +00:00
## Static sites
2017-02-28 12:21:30 +00:00
GitLab Pages only supports static websites, meaning,
your output files must be HTML, CSS, and JavaScript only.
To create your static site, you can either hardcode in HTML,
CSS, and JS, or use a [Static Site Generator (SSG) ](https://www.staticgen.com/ )
to simplify your code and build the static site for you,
which is highly recommendable and much faster than hardcoding.
2017-07-16 16:01:11 +00:00
### Further reading
2017-02-28 12:21:30 +00:00
- Read through this technical overview on [Static versus Dynamic Websites ](https://about.gitlab.com/2016/06/03/ssg-overview-gitlab-pages-part-1-dynamic-x-static/ )
- Understand [how modern Static Site Generators work ](https://about.gitlab.com/2016/06/10/ssg-overview-gitlab-pages-part-2/ ) and what you can add to your static site
- You can use [any SSG with GitLab Pages ](https://about.gitlab.com/2016/06/17/ssg-overview-gitlab-pages-part-3-examples-ci/ )
- Fork an [example project ](https://gitlab.com/pages ) to build your website based upon
2017-07-16 16:01:11 +00:00
## GitLab Pages domain
2017-02-28 12:21:30 +00:00
If you set up a GitLab Pages project on GitLab.com,
it will automatically be accessible under a
2019-03-05 12:55:30 +00:00
[subdomain of `namespace.gitlab.io` ](introduction.md#gitlab-pages-on-gitlabcom ).
2017-02-28 12:21:30 +00:00
The `namespace` is defined by your username on GitLab.com,
or the group name you created this project under.
>**Note:**
If you use your own GitLab instance to deploy your
site with GitLab Pages, check with your sysadmin what's your
Pages wildcard domain. This guide is valid for any GitLab instance,
you just need to replace Pages wildcard domain on GitLab.com
(`*.gitlab.io`) with your own.
2017-09-27 22:12:55 +00:00
Learn more about [namespaces ](../../group/index.md#namespaces ).
2017-09-27 21:53:22 +00:00
2017-07-16 16:01:11 +00:00
### Practical examples
2017-02-28 12:21:30 +00:00
2017-07-16 16:01:11 +00:00
#### Project Websites
2017-02-28 12:21:30 +00:00
- You created a project called `blog` under your username `john` ,
2019-02-22 13:17:10 +00:00
therefore your project URL is `https://gitlab.com/john/blog/` .
Once you enable GitLab Pages for this project, and build your site,
it will be available under `https://john.gitlab.io/blog/` .
2017-02-28 12:21:30 +00:00
- You created a group for all your websites called `websites` ,
2019-02-22 13:17:10 +00:00
and a project within this group is called `blog` . Your project
URL is `https://gitlab.com/websites/blog/` . Once you enable
GitLab Pages for this project, the site will live under
`https://websites.gitlab.io/blog/` .
2018-12-03 11:05:38 +00:00
- You created a group for your engineering department called `engineering` ,
2019-02-22 13:17:10 +00:00
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
GitLab Pages for this project, the site will live under
`https://engineering.gitlab.io/docs/workflows` .
2017-02-28 12:21:30 +00:00
2017-07-16 16:01:11 +00:00
#### User and Group Websites
2017-02-28 12:21:30 +00:00
- Under your username, `john` , you created a project called
2019-02-22 13:17:10 +00:00
`john.gitlab.io` . Your project URL will be `https://gitlab.com/john/john.gitlab.io` .
Once you enable GitLab Pages for your project, your website
will be published under `https://john.gitlab.io` .
2017-02-28 12:21:30 +00:00
- Under your group `websites` , you created a project called
2019-02-22 13:17:10 +00:00
`websites.gitlab.io` . your project's URL will be `https://gitlab.com/websites/websites.gitlab.io` .
Once you enable GitLab Pages for your project,
your website will be published under `https://websites.gitlab.io` .
2017-02-28 12:21:30 +00:00
2019-01-14 12:34:41 +00:00
> Support for subgroup project's websites was [introduced](https://gitlab.com/gitlab-org/gitlab-ce/issues/30548) in GitLab 11.8.
2017-07-16 16:01:11 +00:00
2017-02-28 12:21:30 +00:00
**General example:**
- On GitLab.com, a project site will always be available under
2019-02-22 13:17:10 +00:00
`https://namespace.gitlab.io/project-name`
2017-02-28 12:21:30 +00:00
- On GitLab.com, a user or group website will be available under
2019-02-22 13:17:10 +00:00
`https://namespace.gitlab.io/`
2017-02-28 12:21:30 +00:00
- On your GitLab instance, replace `gitlab.io` above with your
2019-02-22 13:17:10 +00:00
Pages server domain. Ask your sysadmin for this information.
2017-02-28 12:21:30 +00:00
2018-02-20 14:57:36 +00:00
_Read on about [Projects for GitLab Pages and URL structure ](getting_started_part_two.md )._