Skip to content

Commit 83365af

Browse files
committed
Custom domain details
1 parent 313d130 commit 83365af

File tree

1 file changed

+34
-2
lines changed

1 file changed

+34
-2
lines changed

docs/publishing/github-pages.qmd

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ There are three ways to publish Quarto websites and documents to GitHub Pages:
1515

1616
2. Use the `quarto publish` command to publish content rendered on your local machine.
1717

18-
3. Use a [GitHub Action] to automatically render your files (a single Quarto document or a Quarto project) and publish the resulting content whenever you push a source code change to your repository.
18+
3. Use a [GitHub Action](#github-action) to automatically render your files (a single Quarto document or a Quarto project) and publish the resulting content whenever you push a source code change to your repository.
1919

2020
We'll cover each of these methods below, but first an important pre-requisite: you need to have a Git repository on your local machine that is synced to GitHub. The URL of the published website will be derived from the combination of your username and the repository name (e.g. `https://username.github.io/reponame/`).
2121

22-
You can optionally configure a [custom domain](https://docs.github.com/en/pages/configuring-a-custom-domain-for-your-github-pages-site/about-custom-domains-and-github-pages) for a GitHub Pages site, but before exploring that ground you should get your site up and running with the default domain.
22+
You can optionally configure a [custom domain](#custom-domain) for a GitHub Pages site, but before exploring that, get your site up and running with the default domain.
2323

2424
## Render to `docs` {#render-to-docs}
2525

@@ -283,6 +283,38 @@ By default, `quarto publish` will re-render your project before publishing it. H
283283

284284
See the full definition of the Quarto [publish action](https://github.com/quarto-dev/quarto-actions/blob/main/publish/action.yml) to learn about other more advanced options.
285285

286+
## Custom Domain {#custom-domain}
287+
288+
A custom domain allows you to use your own domain name instead of the default `username.github.io` domain for your GitHub Pages site.
289+
To use a custom domain you need to complete two steps:
290+
291+
1. Add your domain to your GitHub repository settings
292+
2. Configure a record with your DNS provider
293+
294+
For the first step, the [GitHub Pages documentation](https://docs.github.com/en/pages/configuring-a-custom-domain-for-your-github-pages-site/managing-a-custom-domain-for-your-github-pages-site) describes adding your domain to your repository in the **Settings** pane.
295+
However, this creates a `CNAME` file in the location of your rendered site,
296+
which will be overwritten whenever you render your site.
297+
Instead, create a `CNAME` file manually in your project root directory (i.e. alongside `_quarto.yml`):
298+
299+
::: {layout-ncol="2"}
300+
301+
```{.default filename="website/"}
302+
├── _site/
303+
├── _quarto.yml
304+
├── CNAME
305+
├── about.qmd
306+
└── index.qmd
307+
```
308+
309+
```{.default filename="CNAME"}
310+
blog.example.com
311+
```
312+
::::
313+
314+
Commit `CNAME`, and push it to GitHub before completing the second step.
315+
316+
Learn more about the second step, and troubleshooting tips in the [GitHub Pages documentation](https://docs.github.com/en/pages/configuring-a-custom-domain-for-your-github-pages-site/about-custom-domains-and-github-pages).
317+
286318
## User Site
287319

288320
In addition to creating sites tied to various repositories, you can also create a user site that is served from your root user domain (e.g. `https://username.github.io`). This is an ideal place to publish a blog or personal home page. To create a user site:

0 commit comments

Comments
 (0)