--- description: | Add components like or <meta> to a <head> tag using Fresh's <Head> component. --- 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 resources like stylesheets using `<link>` - Including third-party JavaScript code using `<script>` ```tsx routes/index.tsx import { Head } from "$fresh/runtime.ts"; export default function Home() { return ( <> <Head> <meta charset="UTF-8" /> <title>Fresh App

Hello World

); } ``` ## Avoiding duplicate tags You might end up with duplicate tags, when multiple `` components are rendered on the same page. This can happen when you render `` in a route and another `` in another component for example. ```tsx routes/page-a.tsx ; ``` ```tsx components/MyTitle.tsx ; ``` 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 - + ``` ```diff components/MyTitle.tsx - + ``` The rendered page will only include the ``-tag with `"Other title"`. > [info]: The ``-tag is automatically deduplicated, even without a `key` > prop.