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
In a **GitHub Workflow** you can make use of the pre-defined env var `GITHUB_REPOSITORY`: `NUXT_APP_BASE_URL="/${GITHUB_REPOSITORY##*/}/" npx nuxt build --preset github_pages`
Head over **GitHub Actions Context** to learn more about the GitHub Actions context variables.
30
+
::
31
+
22
32
## Setup
23
33
24
34
Follow the steps to [create a GitHub Pages site](https://docs.github.com/en/pages/getting-started-with-github-pages/creating-a-github-pages-site).
@@ -46,7 +56,8 @@ jobs:
46
56
node-version: "20"
47
57
# Pick your own package manager and build script
48
58
- run: npm install
49
-
- run: npx nuxt build --preset github_pages
59
+
# Use NUXT_APP_BASE_URL="" if your GitHub Pages is configured for a custom domain
Head over **Nitro documentation** to learn more about the github-pages deployment preset.
76
87
::
88
+
89
+
## Favicons
90
+
91
+
Favicons typically are expected at hosting domain root. In case of a GitHub Pages deployment this does not work.
92
+
93
+
For this reason favicon URLs should be defined for the pages header starting with the GitHub Pages base URL as absolute path to work for a single page app as well as for a multi-route app.
94
+
95
+
::note
96
+
Favicon files should be maintained within the projects `public/` folder.
97
+
::
98
+
99
+
**Example:** If you have `public/favicon.ico` and `public/favicon-16x16.png` your `nuxt.config.ts` should start as follows:
100
+
```ts [nuxt.config.ts]
101
+
// Make use of compile time environment var NUXT_APP_BASE_URL
102
+
// to make baseURL work for GitHub Pages deployments as well.
103
+
// See https://vite.dev/guide/env-and-mode.html for details.
0 commit comments