-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Demonstrate trailing slash bug for canonical urls
- Loading branch information
Showing
4 changed files
with
80 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { Metadata } from "next" | ||
|
||
export function generateMetadata(): Metadata { | ||
return { | ||
title: "Dog Breed Viewer", | ||
// Note that the bug will only happen if the metadataBase is set and if the resolved URL of | ||
// of the page is the same as the metadataBase. So you can only observe the bug with this | ||
// code if running locally. | ||
metadataBase: new URL("https://localhost:3000"), | ||
description: "View images of different dog breeds", | ||
alternates: { | ||
canonical: '/p/12345.html', | ||
} | ||
} | ||
} | ||
|
||
export default function CanonicalUrlBugPage() { | ||
return <h1>Canonical ends with trailing slash</h1> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
/** @type {import('next').NextConfig} */ | ||
const nextConfig = {} | ||
const nextConfig = { | ||
trailingSlash: true, | ||
} | ||
|
||
module.exports = nextConfig |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters