DevLog 2-3
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 ✏️ here using
npm create astro@latestso you remember it. - 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 had difficulty understanding the /../../folder/file layout sometimes and it caused me a lot of headache. Also, the tutorial often had too many or two few /.. when I copied the code into my code which crashed the site.
- 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. - 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 ✏️ 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.