Skip to content

Commit 688ca0a

Browse files
cwickhammcanouil
authored andcommitted
Clarify process for custom domains on GitHub Pages (#1588)
* Clarify * Apply suggestions from code review Co-authored-by: Mickaël Canouil <[email protected]> * Callout values to pay attention to --------- Co-authored-by: Mickaël Canouil <[email protected]> (cherry picked from commit 5b40928)
1 parent 230fb5a commit 688ca0a

File tree

1 file changed

+23
-9
lines changed

1 file changed

+23
-9
lines changed

docs/publishing/github-pages.qmd

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -289,12 +289,11 @@ A custom domain allows you to use your own domain name instead of the default `u
289289
To use a custom domain you need to complete two steps:
290290

291291
1. Add your domain to your GitHub repository settings
292-
2. Configure a record with your DNS provider
292+
2. Configure records with your DNS provider
293293

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`):
294+
### 1. Add your domain to your GitHub repository settings
295+
296+
Add a `CNAME` file to your project root directory (i.e., alongside `_quarto.yml`) that contains your custom domain:
298297

299298
::: {layout-ncol="2"}
300299

@@ -311,11 +310,26 @@ blog.example.com
311310
```
312311
::::
313312

314-
Quarto recognizes the `CNAME` file as a [site resource](/docs/websites/website-tools.qmd#site-resources) and will copy it your site output directory when you render.
315-
Commit `CNAME` (and `docs/CNAME`, if you are publishing from `docs/`),
316-
and push to GitHub before completing the second step.
313+
Quarto will recognize the `CNAME` file as a [site resource](/docs/websites/website-tools.qmd#site-resources) and will copy it your site output directory when you render.
314+
315+
Re-render and publish your site to ensure `CNAME` is available to GitHub Pages.
316+
317+
::: {.callout-note}
318+
319+
The GitHub Pages documentation describes adding your domain to your repository in the **Settings** pane.
320+
However, this creates a `CNAME` file in the location of your rendered site,
321+
which will be overwritten whenever you render your site with Quarto.
322+
323+
:::
324+
325+
326+
### 2. Configure records with your DNS provider
327+
328+
The records you need to configure with your DNS provider depend on whether you are using an apex domain (e.g., `example.com`) or a subdomain (e.g., `www.example.com` or `blog.example.com`).
317329

318-
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).
330+
Apex domains require an `ALIAS`, `ANAME`, or `A` record, whereas subdomains require a `CNAME` record.
331+
Find the appropriate values from the [DNS records summary table in 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#dns-records-for-your-custom-domain).
332+
For apex domains, pay particular attention to the DNS record values, you may need to overwrite addresses your DNS provider has added by default.
319333

320334
## User Site
321335

0 commit comments

Comments
 (0)