Why not write logic in Astro layouts
New Courses Coming Soon
Join the waiting lists
I wrote in Astro page layout and middleware execution order how I moved some logic to a layout.
Had to roll back because turns out I couldn’t run Astro.redirect()
in a layout, since Astro tells me the response has already been sent to the client.
Turns out this was something I absolutely needed, so moved back to handling the logic in the pages, which was ultimately the right thing from the start.
Discovering new things each and every day.
→ Read my Astro Tutorial
on The Valley of Code
Here is how can I help you:
- COURSES where I teach everything I know
- CODING BOOTCAMP cohort course - next edition in 2025
- THE VALLEY OF CODE your web development manual
- BOOKS 17 coding ebooks you can download for free on JS Python C PHP and lots more
- Interesting links collection
- Follow me on X