Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Body can't be set outside of layout #11031

Closed
1 task
reggi opened this issue May 13, 2024 · 1 comment
Closed
1 task

Body can't be set outside of layout #11031

reggi opened this issue May 13, 2024 · 1 comment
Labels
needs triage Issue needs to be triaged

Comments

@reggi
Copy link

reggi commented May 13, 2024

Astro Info

✗ npx astro info
Astro                    v4.7.0
Node                     v21.7.3
System                   macOS (arm64)
Package Manager          npm
Output                   static
Adapter                  none
Integrations             @astrojs/tailwind

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

I have a series of nested layouts and I didn't want the <body> tag included in the root layout because I wanted to be able to add custom tailwind. But I realized that astro will ignore a <body> if it's as a <slot> to a layout. I think the dom is adding a body when you view the tree, but view source shows no body.

What's the expected result?

That I'd be able to set a body from outside the root layout.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-hfbtiv?file=src%2Fpages%2Findex.astro

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label May 13, 2024
@matthewp
Copy link
Contributor

This has never worked very well and I would suggest not doing this. Instead make your layout include the body but pass the props you want to be attached to it.

There is a compiler bug for this already, so going to close this one as a duplicate of withastro/compiler#982

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage Issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

2 participants