Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moving middleware file #36009

Merged
merged 8 commits into from
Apr 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
description: Learn how to use Middleware in Next.js to run code before a request is completed.
---

# Middleware
# Middleware (Beta)

<details open>
<summary><b>Version History</b></summary>
Expand Down
11 changes: 9 additions & 2 deletions docs/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,11 @@
]
},
{
"title": "Middleware",
"path": "/docs/middleware.md"
Copy link
Member

Choose a reason for hiding this comment

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

Looks like we want to keep this entry and update the path to /docs/advanced-features/middleware.md to go along with the redirect. This should resolve the failing check here https://github.com/vercel/next.js/runs/5888873149?check_suite_focus=true#step:4:5

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ijjk Ahh, thank you! I was getting a little confused around how redirects work for these docs. So I understand for the future when we want to move something:

  • Keep the location but update the path to where we want it? (Will this make it confusing for someone coming to the file in the future if this file doesn't mimic the site nav?)
  • The path and redirect path should be the same, but that path uses the .md file type?

Copy link
Member

Choose a reason for hiding this comment

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

So for non-redirect paths it should have the .md extension and points to a file in the docs folder, this is what the lint step is mainly checking for to ensure we don't forget to add manifest entries or have typos.

For redirect paths it doesn't need to have .md as it's matching the path directly without checking the filesystem and the lint step doesn't check these. The destination for the redirect can be any url so if we need to move docs to another site we can e.g. https://vercel.com/docs/some/path but in this case it can just be /docs/advanced-features/middleware since it's the same site.

Seems like it would be good to add this to our contributing, I'll create a PR with notes on this and request your review.

Copy link
Member

Choose a reason for hiding this comment

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

Opened PR with the above info here #36020

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ijjk Thank you so much for taking the time to explain this. The added example in the contributing doc was super helpful!

"path": "/docs/middleware",
"redirect": {
"destination": "/docs/advanced-features/middleware",
"permanent": true
}
},
{
"title": "Going to Production",
Expand Down Expand Up @@ -263,6 +266,10 @@
"title": "Measuring performance",
"path": "/docs/advanced-features/measuring-performance.md"
},
{
"title": "Middleware (Beta)",
"path": "/docs/advanced-features/middleware.md"
},
{
"title": "Debugging",
"path": "/docs/advanced-features/debugging.md"
Expand Down