Introduction
This chapter covers most of the Astro features you’ll commonly use. Subsequent chapters will focus on additional environment setups. Let’s put the site we’ve built onto a server so others can visit it.
SSR vs Static
So far, the tutorial has used Astro in a static-generation approach,
meaning pre-rendered HTML files can be placed on a server and served as static assets. If you need to host an SSR (Server Side Rendering) site, you can choose a cloud provider that offers the corresponding services.
If you want to review dynamic vs static sites, revisit Day 2: Astro 系列文第二日:現有問題與解方
My experience
The documentation from each platform is already quite comprehensive — go take a look: Deploy Guides - Astro DOCS.
- Netlify has excellent integration and developer experience. It’s worth trying and makes deploying via a GUI very straightforward, which is great for beginners.
- GitHub Pages is serviceable, but be careful with asset paths requiring the repo prefix. For example, if your project is stored on GitHub as
accountname/my-project, the default GitHub Pages URL will behttps://accountname.github.io/my-project— you must manually include themy-projectprefix, which can be handled with the base setting. Of course, you can also use your own domain.
Pick a deployment platform you feel comfortable with. I use Cloudflare Pages because their CDN is well-known and it’s a great choice for deploying static files; their docs are simple and the experience has been good so far.
In fact, deploying static sites rarely reaches paid tiers — choose one that looks good to you and don’t overthink it.
Summary
The above are my experiences deploying static sites. Future posts will cover concepts, thoughts, and surrounding configuration topics.
- Day21 - 部屬升空 - The same article is also published on iThome Ironman.