Thanks for choosing Astro starter. This is a template I’ve crafted for accessible, semantic HTML.
You will find the index.astro page intentionally empty. Astro starter is intentionally bare-bones, with the bare minimum you need to get started on a basic blog website.
- vanilla CSS
- zero-JS minus the
ViewTransitionsAPI - shorthand
importstatements - accessible navigation components, pre-integrated with Astro’s active page via
aria-current - optimized images via
srcset, even in.mdfiles - one single layout to rule them all
-
.astrofiles and only.astrofiles. You might find some.tsfiles lying around, but Astro kind of forces that on you 🤷 - Netlify 🔗 integration for SSR out of the box (if you don’t want this, then remove the
netlifyadapter)
Table of Contents
Table of Contents
Markdown Features
- If you include the text “Table of Contents” as a heading in your markdown documents, then
remarkwill automatically generate a table of contents for you like this. - Custom markdown theme
Directory Structure
Use the standard Astro directory structure, except for a few differences:
utilsfolder for utilities. If you havefunctions that you want to re-use in other places (server-side), then you put them herecontent/blogfolder for blog posts. You can, of course, repurpose theconfig.tsfile to add other content collectionsconfig.tsfile for global site configuration such as thetitleanddescription<meta>tags
import shorthands
imports become more refactorable because we don’t have to use relative paths.
| Shorthand | Path |
|---|---|
@components | ./src/components |
@utils | ./src/utils |
@contexts | ./src/contexts |
@hooks | ./src/hooks |
@styles | ./src/styles |
@assets | ./src/assets |
@pages | ./src/pages |
Included Components
Astro starter includes basic components for navigation and blog posts. Feel free to remove these components if you don’t need them.
| Component | Purpose |
|---|---|
blog/Post.astro | A full post |
blog/PostHeader.astro | Just the post’s header, including post metadata |
blog/PostList.astro | A list of posts |
blog/PostMeta.astro | All metadata of a post |
navigation/Navigation.astro | Container element for navigation (<nav>). Used in conjunction with <NavigationLink> |
navigation/NavigationLink.astro | Navigation link that sets aria-current appropriately depending on the active page |
Footer.astro | Basic component for the site footer |
FormattedDate.astro | Dynamic <time> element |
Header.astro | Basic component for the site header. Includes basic navigation. |
Getting Started
- Initiate a new Astro project with the template:
git clone https://github.com/srsgores/astro-starter - Update
config.tswith your project settings - (Optional): install
astro-icon:npm install astro-icon
Out of the box, your images will be served responsively. You can remove this file or repurpose the files in content to your liking if you don’t want a blog.
Conclusion
This is just one starting point of many. Astro users enjoy the framework because of its versatility