Skip to content

Set trailingSlash to always in astro config#1925

Open
arx-ein wants to merge 2 commits intomasterfrom
20260330-trailingSlash-always
Open

Set trailingSlash to always in astro config#1925
arx-ein wants to merge 2 commits intomasterfrom
20260330-trailingSlash-always

Conversation

@arx-ein
Copy link
Copy Markdown
Contributor

@arx-ein arx-ein commented Mar 30, 2026

本番環境では /foo/bar にアクセスすると /foo/bar/ にリダイレクトしてくれるようになっているのですが、 dev 環境で出てきたページは /foo/bar にアクセスしても trailing slash がない状態でページがそのままお出しされ、相対リンク関係の挙動が変わってしまうため、検証に余計なミスが発生してしまった ということがありました。
そこで astro.config.tstrailingSlash: "always" を追加したいのですが、構いませんか?本番環境での挙動は変化せず、開発環境で誤って trailing slash なしのページ (本番環境ではアクセスし得ない) にアクセスした際に警告を出してくれるようになります。build.format の説明でも開発環境で混乱しないようにこの設定を変えておくことが提案されています。

参考
https://docs.astro.build/en/reference/configuration-reference/#trailingslash
https://docs.astro.build/en/reference/configuration-reference/#buildformat

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 30, 2026

🚀 Deployed on https://deploy-preview-1925--utelecon.netlify.app

Copy link
Copy Markdown
Member

@seieric seieric left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ubuntu上では動作が確認されたものの、Windows上ではMarkdown内に/notice/absolute/path/のように絶対パス表記があるページでMarkdownのパースに失敗してしまう問題があるようです。

Changes from #1924 should fix Windows path resolution error
@arx-ein
Copy link
Copy Markdown
Contributor Author

arx-ein commented Apr 1, 2026

指摘してくださったパース失敗は Windows系/UNIX系 のパス表記の違いによるもので、これは #1924 で修正されたため master を引き入れることによって解決を図りました。これで Windows でも正常に動作するはずだと思います。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants