astro is a framework that allows us to remove some of the difficulties of writing a functional,
accessible HTML site. We use this framework in our course to speed up our learning and provide
exposure to modern web design practices and technologies.
For more on installing astro and supporting tooling, see the astro template
available in this course’s Github organization.
Either .astro or .mdx files can implement components, the heart of the astro build
platform. Consider again our main index page for our current template site:
<!Doctypehtml>
<htmllang="en">
<!-- This is common to all pages, but maybe the title isn't -->
<!-- main body content might be a reusable component in this layout -->
<main>
<h1>Astro</h1>
</main>
<!-- TODO: Add a footer? -->
</body>
</html>
Implementing components allows us to learn a little bit more about our file structure
and gain some insight into how astro works. Here, we’re going to add a few components
and a layout.
/
├── public/
├── src/
│ └── pages/
│ | └── index.astro
│ └── layouts/
│ └── BaseLayout.astro
│ └── components/
│ └── Footer.astro
│ └── Header.astro
│ └── Nav.astro
The pages folder constitutes the routes that our site offers, and right now it has a single
index file, which responds at /, the lowest level of the URL hierarchy of our site. As we
add different components, we will change how that file is structured, though not much about
its design.
To follow along with changes made, head to dluman.github.io to check out
how the files are coming together.
This course uses astro to implement our webpages. This means that we will use bothMarkdownandHTML to create pages: mostly in terms of headings, lists, and paragraphs. More specific HTML formatting
that goes beyond simple document construction will rely on writing HTML directly in our files.
The following table lists Markdown tags that their HTML equivalents: