docs: improve examples and fix app wrapper (#1244)

This commit is contained in:
Luca Casonato
2023-06-03 22:20:18 +02:00
committed by GitHub
parent a724f6c591
commit 96be590a90
4 changed files with 9 additions and 39 deletions
+1 -1
View File
@@ -8,4 +8,4 @@ that you may like in your Fresh project. If there's a specific example you'd
like to see here, please open
[a GitHub discussion](https://github.com/denoland/fresh/discussions/new?category=ideas).
- [Modifying the `<head>` Element](modifying-the-head-element)
- [Modifying the `<head>`](./examples/modifying-the-head)
@@ -1,16 +1,17 @@
---
description: |
By adding inner components to Fresh's head element, we add inner components to the HTML head element of the web page.
Add components like <title> or <meta> to a <head> tag using Fresh's <Head> component.
---
We can use the `<Head />` component in `$fresh/runtime.ts` to modify the
`<head>` element. By adding inner components to `<Head />`, we add inner
components to the `<head>` element of the web page. Some uses include:
We can use the `<Head />` component in `$fresh/runtime.ts` to add elements as
children of the `<head>` element. By adding elements as children of Fresh's
`<Head />` tag, these automatically get injected into the `<head>` element of
the web page. Some uses include:
- Setting the document title using `<title>`
- Specifying page metadata using `<meta>`
- Linking to external resources using `<link>`
- Including JavaScript code using `<script>`
- Linking to resources like stylesheets using `<link>`
- Including third-party JavaScript code using `<script>`
```tsx
// routes/index.tsx