diff --git a/docs/publishing/github-pages.qmd b/docs/publishing/github-pages.qmd index d0f1d77019..59fc75ffb9 100644 --- a/docs/publishing/github-pages.qmd +++ b/docs/publishing/github-pages.qmd @@ -103,6 +103,23 @@ If you are publishing to a private (i.e. password protected) website then the lo quarto publish gh-pages --no-browser ``` +#### Custom Domains + +There are a few steps you will need to take to publish to a custom subdomain, such as publishing a website to `site.example.com` instead of `www.example.com/repo-name`: + +1. [Create a CNAME record](https://docs.github.com/en/pages/configuring-a-custom-domain-for-your-github-pages-site/managing-a-custom-domain-for-your-github-pages-site#configuring-a-subdomain) with your DNS provider. +2. Change the configuration on GitHub. Open the webpage for your GitHub repository, click on "Settings", then "Pages", then "Custom Domain", and enter the domain name in the text field (e.g., `site.example.com`). +3. Create a file called CNAME in the root directory of your project; the only content of the CNAME file is the custom domain (e.g., `site.example.com`). +4. Add the `site-url` and the CNAME file to your `_quarto.yml` file like this: + +``` {.yaml filename="_quarto.yml"} +resources: + - "CNAME" + +website: + site-url: "site.example.com" +``` + #### Documents To publish a document rather than a website or book, provide the path to the document (note that you can publish only one document from a given GitHub repository):