Open eikowagenknecht opened 2 months ago
Have you tried the build format preserve
? https://docs.astro.build/en/reference/configuration-reference/#buildformat
I think that's what you're looking for...
I've tried that one as well, the result is still the same for the feed:
File pages/feed.js
, trailingSlash: always
, build.format: preserve
:
/feed
: 404 error/feed/
: Shows the RSS/feed
: Shows the RSS/feed/
: 404 errorAlso, all other links show in file
style (e.g. https://example.com/blog
instead of https://example.com/blog/
) now, which is not what I want.
It seems like for endpoint rules (xyz.js
files), no matter what is set as build.format
, the output is always xyz
.
feed.js
> feed
feed.xml.js
> feed.xml
feed/index.js
> feed
feed.xml/index.js
> feed.xml
feed.xml/index.html.js
> feed.xml.html
All output is always in the root, no directory is created.
Ok, I know what's the issue, and it's not the first one.
The issue is that we impose trailingSlash
on endpoints too. It's not the first issue that was filed, however we can't change the behaviour lightly.
We plan to change this behaviour in Astro 5.0, by not applying trailingSlash
to endpoints. This will be a breaking change.
The only workaround that I can suggest is to change is to use trailingSlash: ignore
, however I know that probably won't solve your issue.
Astro Info
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
For my site, I use the "directory" format:
https://example.com/page/
I would like to have my RSS feed like this as well:
https://example.com/feed/
But I can't find any combination of the generating endpoint file name, trailingSlash and build.format to achieve this.
File
/pages/feed.js
,trailingSlash: always
,build.format: directory
: -> DEV:/feed
has a 404,/feed/
works. PROD: Generates/feed
file,/feed/
has a 404File
/pages/feed/index.js
,trailingSlash: always
,build.format: directory
: -> Same behaviour as/pages/feed.js
If it's not possible to put an RSS feed as a directory, I would be kind of content with just using
/rss.xml
, but that has it's own problem: It is not reachable on the DEV server any more.File
/pages/rss.xml.js
,trailingSlash: always
,build.format: directory
: -> DEV:/rss.xml
has a 404,/rss.xml/
works. PROD: Generates/rss.xml
file,/rss.xml/
has a 404What's the expected result?
There should be a combination of
trailingShash
andbuild.format
that behaves consistently for DEV and PROD for endpoint routes.Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-6vyntu
Participation