Skip to content

Commit

Permalink
chore: release 1.5.0 (#1899)
Browse files Browse the repository at this point in the history
  • Loading branch information
marvinhagemeister authored Oct 10, 2023
1 parent bc89844 commit fe2c95c
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 319 deletions.
106 changes: 0 additions & 106 deletions docs/canary/concepts/app-wrapper.md

This file was deleted.

128 changes: 0 additions & 128 deletions docs/canary/concepts/updating.md

This file was deleted.

79 changes: 0 additions & 79 deletions docs/canary/examples/modifying-the-head.md

This file was deleted.

File renamed without changes.
2 changes: 1 addition & 1 deletion docs/latest/concepts/updating.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ To run the auto updater, run the following command from the root of your
project:

```sh Terminal
$ deno run -A -r https://fresh.deno.dev/update .
$ deno run -A -r https://fresh.deno.dev/update
```

You will be prompted to confirm the changes that will be made to your project.
Expand Down
File renamed without changes.
41 changes: 41 additions & 0 deletions docs/latest/examples/modifying-the-head.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,44 @@ export default function Home() {
);
}
```

## Avoiding duplicate tags

You might end up with duplicate tags, when multiple `<Head />` components are
rendered on the same page. This can happen when you render `<Head />` in a route
and another `<Head />` in another component for example.

```tsx
// routes/page-a.tsx
<Head>
<meta name="og:title" content="This is a title" />
</Head>

// components/MyTitle.tsx
<Head>
<meta name="og:title" content="Other title" />
</Head>
```

To ensure that the tag is not duplicated, Fresh supports setting the `key` prop.
By giving matching elements the same `key` prop, only the last one will be
rendered.

```diff
// routes/page-a.tsx
<Head>
- <meta name="og:title" content="This is a title" />
+ <meta name="og:title" content="This is a title" key="title" />
</Head>

// components/MyTitle.tsx
<Head>
- <meta name="og:title" content="Other title" />
+ <meta name="og:title" content="Other title" key="title" />
</Head>
```

The rendered page will only include the `<meta>`-tag with `"Other title"`.

> [info]: The `<title>`-tag is automatically deduplicated, even without a `key`
> prop.
Loading

0 comments on commit fe2c95c

Please sign in to comment.