The trailing slash is not cosmetic. It decides which URL your host answers without a redirect , and everything else you write β internal links, canonical, sitemap β has to agree with it.
With build.format: 'directory' , Astro emits page/index.html . A static host then serves /page/ directly and sends /page through a 308 to get there. Measured on a site using trailingSlash: 'always' plus the directory format:
curl -o /dev/null -w "%{http_code} %{redirect_url}" https:// < site > /about 308 https:// < site > /about/
Enter fullscreen mode
Exit fullscreen mode
One extra hop per internal link, invisible in the browser, paid by every crawler and every first-time visitor.
The three declarations
Config β trailingSlash and build.format decide the on-disk shape, which decides what the host serves without a redirect.
Links in the markup β every href you typed by hand, in markdown and in components.
canonical and the sitemap β declarations of address, not navigational links.
always and never are bothβ¦