Skip to content

Commit

Permalink
Merge branch 'main' into vercel-cleanurls-true-trailingslash-undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
slorber committed Jul 11, 2021
2 parents de569df + a5b3e29 commit 252d26d
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 5 deletions.
10 changes: 8 additions & 2 deletions docs/Hosting-Providers.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,16 @@ Netlify has a setting `Post Processing > Asset Optimization > Pretty Urls` that

## Vercel

Vercel has a [`cleanUrls` option](https://vercel.com/docs/configuration#project/clean-urls), affecting how files are served.
Vercel has 2 options affecting how files are served with 6 possible combinations:
- [`cleanUrls`](https://vercel.com/docs/configuration#project/clean-urls)
- [`trailingSlash`](https://vercel.com/docs/configuration#project/trailing-slash)

**Important**: Next.js also has a distinct [`trailingSlash` option](https://nextjs.org/docs/api-reference/next.config.js/trailing-slash)

**Important**: surprisingly, by default `next export` creates `/myPath.html` but this filename is not well-supported by Vercel by default (unless you use `cleanUrls: true`)

### Default settings (no config file)

**Deployment**: [trailing-slash-guide.vercel.app](https://trailing-slash-guide.vercel.app)

| Url | Result |
Expand Down Expand Up @@ -168,4 +174,4 @@ Vercel has a [`cleanUrls` option](https://vercel.com/docs/configuration#project/

## TODO: add other hosting providers

TODO add all other static hosting providers: S3/CloudFront, Amplify, Azure, Heroku, Surge, Firebase... and self-hosting tools (Apache, Nginx...)
TODO add all other static hosting providers: S3/CloudFront, Amplify, Azure, Heroku, Surge, Firebase, Gatsby Cloud ... and self-hosting tools (Apache, Nginx...)
8 changes: 7 additions & 1 deletion docs/Static-Site-Generators.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,19 @@ Let's figure out how different static site generators output static files for ro

- Command: `next export`
- Default output: `/myPath.html`
- Configuration: [trailingSlash option](https://nextjs.org/docs/api-reference/next.config.js/trailing-slash)
- Configuration: [trailingSlash option](https://nextjs.org/docs/api-reference/next.config.js/trailing-slash) (different from Vercel [trailingSlash option](https://vercel.com/docs/configuration#project/trailing-slash))

## Docusaurus

- Default output: `/myPath/index.html`
- Configuration: [trailingSlash option](https://docusaurus.io/docs/docusaurus.config.js#trailing-slash)

## NuxtJS

- Command: `nuxt generate`
- Default output: `/myPath/index.html`
- Configuration: [trailingSlash option](https://nuxtjs.org/docs/2.x/configuration-glossary/configuration-router#trailingslash)

## TODO: add other static site generators

TODO add all other static site generators
Expand Down
53 changes: 51 additions & 2 deletions static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,16 @@
];

const Deployments = [
/////////////////////////////////////////////////////////////////////////////////////////////

{
name: "GitHub Pages",
settings: "" ,
url: "https://slorber.github.io/trailing-slash-guide"
},

/////////////////////////////////////////////////////////////////////////////////////////////

{
name: "Netlify",
settings: "Default",
Expand All @@ -37,26 +42,70 @@
settings: "Pretty Urls off",
url: "https://trailing-slash-guide-pretty-url-disabled.netlify.app"
},

/////////////////////////////////////////////////////////////////////////////////////////////

{
name: "Vercel",
settings: "",
url: "https://trailing-slash-guide.vercel.app"
settings: "Default",
url: "https://vercel-default-eight.vercel.app/"
},
{
name: "Vercel",
settings: "cleanUrls=false trailingSlash=undefined",
url: "https://vercel-cleanurls-false-trailingslash-undefined.vercel.app/"
},
{
name: "Vercel",
settings: "cleanUrls=false trailingSlash=false",
url: "https://vercel-cleanurls-false-trailingslash-false.vercel.app/"
},
{
name: "Vercel",
settings: "cleanUrls=false trailingSlash=true",
url: "https://vercel-cleanurls-false-trailingslash-true.vercel.app/"
},
{
name: "Vercel",
settings: "cleanUrls=true trailingSlash=undefined",
url: "https://vercel-cleanurls-true-trailingslash-undefined.vercel.app/"
},
{
name: "Vercel",
settings: "cleanUrls=true trailingSlash=false",
url: "https://vercel-cleanurls-true-trailingslash-false.vercel.app/"
},
{
name: "Vercel",
settings: "cleanUrls=true trailingSlash=true",
url: "https://vercel-cleanurls-true-trailingslash-true.vercel.app/"
},

/////////////////////////////////////////////////////////////////////////////////////////////

{
name: "Cloudflare Pages",
settings: "",
url: "https://trailing-slash-guide.pages.dev"
},

/////////////////////////////////////////////////////////////////////////////////////////////

{
name: "Render",
settings: "",
url: "https://trailing-slash-guide.onrender.com"
},

/////////////////////////////////////////////////////////////////////////////////////////////

{
name: "Azure Static Web Apps",
settings: "",
url: "https://polite-bay-08a23e210.azurestaticapps.net/"
},

/////////////////////////////////////////////////////////////////////////////////////////////
];

// GH pages urls start with /trailing-slash-guide/ => we don't want the baseurl to pollute the result
Expand Down

1 comment on commit 252d26d

@vercel
Copy link

@vercel vercel bot commented on 252d26d Jul 11, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deployment failed with the following error:

`trailingSlash` should be boolean

Please sign in to comment.