Skip to content

Commit 9c8f074

Browse files
ecstremabenmccannRich-Harris
authored
Adapter-static documentation: Github pages (#2135)
* Adapter-static documentation: Github pages * Update capitalization * Remove boilerplate * Integrate proposed changes to adapter-static documentation concerning GitHub Pages. * tweaks Co-authored-by: Ben McCann <[email protected]> Co-authored-by: Rich Harris <[email protected]>
1 parent a24aba9 commit 9c8f074

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

packages/adapter-static/README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,30 @@ export default {
6161

6262
When operating in SPA mode, only pages that have the [`prerender`](https://kit.svelte.dev/docs#ssr-and-javascript-prerender) option set will be prerendered.
6363

64+
## GitHub Pages
65+
66+
When building for GitHub Pages, make sure to update [`paths.base`](https://kit.svelte.dev/docs#configuration-paths) to match your repo name, since the site will be served from https://your-username.github.io/your-repo-name rather than from the root.
67+
68+
You will have to prevent GitHub's provided Jekyll from managing your site by putting an empty `.nojekyll` file in your static folder. If you do not want to disable Jekyll, change the kit's `appDir` configuration option to `'app_'` or anything not starting with an underscore. For more information, see GitHub's [Jekyll documentation](https://docs.github.com/en/pages/setting-up-a-github-pages-site-with-jekyll/about-github-pages-and-jekyll#configuring-jekyll-in-your-github-pages-site).
69+
70+
A config for GitHub Pages might look like the following:
71+
72+
```js
73+
/** @type {import('@sveltejs/kit').Config} */
74+
const config = {
75+
...
76+
kit: {
77+
...
78+
paths: {
79+
base: '/your-repo-name',
80+
},
81+
// If you are not using a .nojekyll file, change your appDir to something not starting with an underscore.
82+
// For example, instead of '_app', use 'app_', 'internal', etc.
83+
appDir: 'internal',
84+
}
85+
};
86+
```
87+
6488
## Changelog
6589

6690
[The Changelog for this package is available on GitHub](https://github.com/sveltejs/kit/blob/master/packages/adapter-static/CHANGELOG.md).

0 commit comments

Comments
 (0)