DevLog 2-3
Outcomes
Section titled “Outcomes”DevLog 2-3
Section titled “DevLog 2-3”Create an Astro blog site
Section titled “Create an Astro blog site”Follow Astro’s Build a Blog tutorial to create a modular website using component-based design. Compare your finished blog site to the tutorial example as needed.
- Create a new Astro site and publish it on Netlify1. Write the formatted command
npm create astro@latest. - Create pages (
.astrofiles) and blog posts (.mdfiles) using frontmatter and file-based routing2. - Use Astro components (also
.astrofiles!) to reuse common code across your website3. - Create reusable layout components using
<slot />andAstro.propsto inject child content4. - Create layout components for markdown files. Share anything that was difficult so far.
I thought it was pretty straightforward up to this point. I found that it is a little confusing when styling is put directly into a file rather than a styling sheet which is what I'm used to. It is especially confusing when a layout is used. I understand it, it will just take some getting used to. - Display a dynamically generated list of posts on your Blog page5.
- Use Dynamic page routing with
getStaticPaths()to specify and store static routes during build, and pass each page its own props. - Install Astro Preact integration. Use a
client:directive for hydration on a UI framework component6. 🔥 Challenge: Already have experience with a UI library? Try to integrate that one instead! For example, I used Svelte.I just did Preact - Modify your site design and content as if you were transitioning to Astro.js from an existing Wordpress site/blog. Duplicate the design, content, structure from the other site (not entirely, mind you, since this is just a mockup). Publish your blog site and put the url Blog Site here.
- Copy and paste these instructions into
devlog-2-3.mdxin your own DevLog. Publish it. Then turn it in by posting a direct link to the page on Moodle.