You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/publishing/github-pages.qmd
+36-2Lines changed: 36 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -15,11 +15,11 @@ There are three ways to publish Quarto websites and documents to GitHub Pages:
15
15
16
16
2. Use the `quarto publish` command to publish content rendered on your local machine.
17
17
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.
19
19
20
20
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/`).
21
21
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.
23
23
24
24
## Render to `docs` {#render-to-docs}
25
25
@@ -283,6 +283,40 @@ By default, `quarto publish` will re-render your project before publishing it. H
283
283
284
284
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.
285
285
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
+
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.
317
+
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).
319
+
286
320
## User Site
287
321
288
322
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:
Copy file name to clipboardExpand all lines: docs/websites/website-tools.qmd
+8Lines changed: 8 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -359,6 +359,14 @@ An example script that is used for user tracking would look like:
359
359
360
360
Besides input and configuration files, your site likely also includes a variety of resources (e.g. images) that you will want to publish along with your site. Quarto will automatically detect any files that you reference within your site and copy them to the output directory (e.g. `_site`).
361
361
362
+
Quarto also recognizes the following files and copies them to your output directory:
363
+
364
+
* `404.html`, one option for providing a [404 Page](/docs/websites/website-navigation.qmd#pages-404)
365
+
* `robots.txt`, a file specified by the [Robots Exclusion Protocol](https://datatracker.ietf.org/doc/html/rfc9309){.external} that tells search engine crawlers which pages or files on your website they can or cannot access
366
+
* `_redirects`, a file used by some publishing providers to provide page redirects, e.g. [Netlify](https://docs.netlify.com/routing/redirects/#syntax-for-the-redirects-file){.external}
367
+
* `CNAME`, a file used by some publishing providers to specify a custom domain, e.g. [GitHub Pages](/docs/publishing/github-pages.qmd#custom-domain)
368
+
* `.nojekyll`, a file used by GitHub pages to bypass building with Jekyll, e.g. when [publishing from `docs/`](/docs/publishing/github-pages.qmd#render-to-docs)
369
+
362
370
If this auto-detection fails for any reason, or if you want to publish a file not explicitly linked to from within your site, you can add a `resources` entry to your configuration. For example, here we specify that we want to include all Excel spreadsheets within the project directory as part of the website:
0 commit comments