Skip to content

Commit

Permalink
Docs: Make "With URL Obeject" only displayed in Pages docs (#65547)
Browse files Browse the repository at this point in the history
App router [does not
support](https://nextjs.org/docs/messages/app-dir-dynamic-href) dynamic
hrefs: removing it from the app router docs, and only having it in the
pages router docs.

Fixes #65505

---------

Co-authored-by: samcx <sam@vercel.com>
  • Loading branch information
maxhaomh and samcx committed May 14, 2024
1 parent b5fb1c1 commit add70da
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/02-app/02-api-reference/01-components/link.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,8 @@ function Home() {
export default Home
```

<PagesOnly>

### With URL Object

`Link` can also receive a URL object and it will automatically format it to create the URL string. Here's how to do it:
Expand Down Expand Up @@ -437,6 +439,8 @@ The above example has a link to:

You can use every property as defined in the [Node.js URL module documentation](https://nodejs.org/api/url.html#url_url_strings_and_url_objects).

</PagesOnly>

### Replace the URL instead of push

The default behavior of the `Link` component is to `push` a new URL into the `history` stack. You can use the `replace` prop to prevent adding a new entry, as in the following example:
Expand Down

0 comments on commit add70da

Please sign in to comment.