You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At some point of the tutorial, you are tasked with refactoring existing pages to use a BaseLayout instead:
At that point your files look like this:
src/pages/about.astro
---importHeaderfrom"../components/Header.astro";importFooterfrom"../components/Footer.astro";import"../styles/global.css";const pageTitle ="About Me";const identity = { firstName: "Sarah", country: "Canada", occupation: "Technical Writer", hobbies: ["photography", "birdwatching", "baseball"],};const skills = ["HTML", "CSS", "JavaScript", "React", "Astro", "Writing Docs"];const happy =true;const finished =false;const goal =3;const skillColor ="navy";const fontWeight ="bold";const textCase ="uppercase";---
<htmllang="en">
<head>
<metacharset="utf-8" />
<linkrel="icon"type="image/svg+xml"href="/favicon.svg" />
<metaname="viewport"content="width=device-width" />
<metaname="generator"content={Astro.generator} />
<title>{pageTitle}</title>
<styledefine:vars={{ skillColor, fontWeight, textCase }}>
h1 {
color: purple;
font-size: 4rem;
}
.skill {
color: var(--skillColor);
font-weight: var(--fontWeight);
text-transform: var(--textCase);
}
</style>
</head>
<body>
<Header />
<h1>{pageTitle}</h1>
<h2>... and my new Astro site!</h2>
<p>
I am working through Astro's introductory tutorial. This is the second
page on my website, and it's the first one I built myself!
</p>
<p>
This site will update as I complete more of the tutorial, so keep checking
back and see how my journey is going!
</p>
<p>Here are a few facts about me:</p>
<ul>
<li>My name is {identity.firstName}.</li>
<li>
I live in {identity.country} and I work as a {identity.occupation}.
</li>
{identity.hobbies.length>=2&& (
<li>
Two of my hobbies are: {identity.hobbies[0]} and{""}{identity.hobbies[1]}
</li>
)
}
</ul>
<p>My skills are:</p>
<ul>
{skills.map((skill) => <liclass="skill">{skill}</li>)}
</ul>
{happy&& <p>I am happy to be learning Astro!</p>}{finished&& <p>I finished this tutorial!</p>}{goal===3? (
<p>My goal is to finish in 3 days.</p>
) : (
<p>My goal is not 3 days.</p>
)
}
<Footer />
<script>
import "../scripts/menu.ts";
</script>
</body>
</html>
📋 Explain your issue
At some point of the tutorial, you are tasked with refactoring existing pages to use a
![image](https://private-user-images.githubusercontent.com/10464497/331615365-a67c371d-6fee-4367-9248-f0b13410b871.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjE4NjA2ODksIm5iZiI6MTcyMTg2MDM4OSwicGF0aCI6Ii8xMDQ2NDQ5Ny8zMzE2MTUzNjUtYTY3YzM3MWQtNmZlZS00MzY3LTkyNDgtZjBiMTM0MTBiODcxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MjQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzI0VDIyMzMwOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTQ2N2M3Mzk1ZmQxNGIxMGU2NGM3NDk3N2QyMWFmYzYyMjFjOWI1MWRiOGIzYmQ5OGUwZDNmMmY1OTM5Nzg1MzUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.nRFyHC4Q7R2c61G6LGVDxzA-7qaPzNuEoZIBIJb-MF8)
BaseLayout
instead:At that point your files look like this:
src/pages/about.astro
src/layouts/BaseLayout.astro
It's not intuitive for a beginner how you are going to retain the following
<style>
block inside the<head>
after the refactoring:The text was updated successfully, but these errors were encountered: