Skip to content

Commit

Permalink
docs: update layouts.mdx
Browse files Browse the repository at this point in the history
  • Loading branch information
jsparkdev committed Jan 11, 2025
1 parent cde29ca commit 6c10eb9
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/content/docs/en/basics/layouts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ We conventionally use the term "layout" for Astro components that provide common

But, there is nothing special about a layout component! They can [accept props](/en/basics/astro-components/#component-props) and [import and use other components](/en/basics/astro-components/#component-structure) like any other Astro component. They can include [UI frameworks components](/en/guides/framework-components/) and [client-side scripts](/en/guides/client-side-scripts/). They do not even have to provide a full page shell, and can instead be used as partial UI templates.

However, if a layout component does contain a page shell, its `<html>` element must be the parent of all other elements in the component. All [`<style>`](/en/guides/styling/#styling-in-astro) or [`<script>`](/en/guides/client-side-scripts/#using-script-in-astro) elements must be enclosed by the `<html>` tags.
However, if a layout component does contain a page shell, its `<html>` element must be the parent of all other elements in the component.

Layout components are commonly placed in a `src/layouts` directory in your project for organization, but this is not a requirement; you can choose to place them anywhere in your project. You can even colocate layout components alongside your pages by [prefixing the layout names with `_`](/en/guides/routing/#excluding-pages).

Expand Down Expand Up @@ -45,12 +45,13 @@ const { title } = Astro.props;
</article>
<Footer />
</body>
<style>
h1 {
font-size: 2rem;
}
</style>
</html>
<style>
h1 {
font-size: 2rem;
}
</style>
```

```astro title="src/pages/index.astro"
Expand Down

0 comments on commit 6c10eb9

Please sign in to comment.