-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ability to prerender to about.html
instead of about/index.html
like Sapper
#1443
Comments
This is correct / intended: https://kit.svelte.dev/docs#ssr-and-javascript-prerender-route-conflicts
This is (possibly?) not. |
Is there really no way to get |
A recent-ish new feature in Sapper was to have In any case, |
tralilingSlash: 'ignore'
is used
Hi, I also want to create non-indexed HTML file and I found this issue. It would be useful if we could use a route which ends with .html , especially for custom 404 page for some platforms (See Additional Information of my comment ). I made PR for this: #1939 |
about.html
instead of about/index.html
like Sapper
Rich suggested he'd like to see this done in SvelteKit with a new boolean option rather than by renaming the file extension. I've closed the associated PR given that, but if anyone would like to take a stab at it with the new direction I'd be happy to take a look |
Usage: ```json kit: { prerender: { subfolders: false, }, ``` Setting the kit.prerender.subfolders setting to false (default is true) will change the filename generation from "/about/index.html" to "/about.html" Inspiration for the `subfolders` name came from nuxt: https://nuxtjs.org/docs/configuration-glossary/configuration-generate/#subfolders - Fixes sveltejs#1443, - Related to sveltejs#2276, [sapper/sveltejs#1021](sveltejs/sapper#1021)
- Fixes sveltejs#1443 Setting the kit.prerender.subfolders to false (default is true) will change the filename generation from "/about/index.html" to "/about.html"
- Fixes sveltejs#1443 Setting the kit.prerender.subfolders to false (default is true) will change the filename generation from "/about/index.html" to "/about.html"
- Fixes sveltejs#1443 Setting the kit.prerender.subfolders to false (default is true) will change the filename generation from "/about/index.html" to "/about.html"
- Fixes sveltejs#1443 Setting the kit.prerender.subfolders to false (default is true) will change the filename generation from "/about/index.html" to "/about.html"
out of curiosity, did Rich mean a boolean option in each file, or a global one in in the mean time, using the file extension to indicate output turned out not to be too hard to write as a postbuild script i added #! /usr/bin/env bash
# move *.html/index.html to *.html in $build
build="$1"
err=0
for dir in $(find "$build" -path '*.html/index.html')
do
parent="$(dirname $dir)"
num=$(ls "$parent" | wc -l)
if (( num != 1 ))
then
(( err++ ))
echo warning: expected exactly one file: skipping \"$parent\"
continue
fi
mv "$dir" "$parent.temp"
rm -r "$parent"
mv "$parent.temp" "$parent"
done
exit $err |
- Fixes sveltejs#1443 Setting the kit.prerender.subfolders to false (default is true) will change the filename generation from "/about/index.html" to "/about.html"
I've rebased PR 2632, any feedback that prevents merging this PR would be appreciated. |
* [feat] add prerender.subfolders setting - Fixes #1443 Setting the kit.prerender.subfolders to false (default is true) will change the filename generation from "/about/index.html" to "/about.html" * remove separate prerender tests in favour of the new test suite * on second thoughts, save that for a follow-up PR * remove unused file * rename prerender.subfolders to prerender.createIndexFiles Co-authored-by: Bob Fanger <b.fanger@wearetriple.com> Co-authored-by: Rich Harris <hello@rich-harris.dev>
In
|
Is this fixed? I am the bellow packages with trailingSlash: true but still gettting 'example.html' instead of '/example/index.html'
|
@archoda Upgrade your packages to their latest versions. |
Describe the bug
When setting
tralilingSlash: 'ignore'
then the static adapter generates wrong files, e.g.blog/hello-world.html.svelte
is generated asblog/hello-world.html/index.html
about.svelte
is generated asabout/index.html
To Reproduce
Here is a repo with issue reproduction, generated files are also pushed to the main branch in
dist
directory: https://github.com/bdadam/svelte-kit-static-issueThe repo was freshly created with
npm init svelte@next .
.Expected behavior
blog/hello-world.html.svelte
=>blog/hello-world.html.html
about.svelte
is generated asabout.html
Information about your SvelteKit Installation:
npm init svelte@next .
yarn add -D @sveltejs/adapter-node@next
to install the static adapterSeverity
For me this is a blocker in adopting Svelte Kit for one side project. I have a website which has 6+ years old URLs with .html extensions, e.g.
https://example.com/blog/hello-world.html
. I don't want to touch these URLs due to all the SEO rank and backlinks they received throughout the years. In all honesty this is a toy project - but I guess I'm not alone with this requirement.The text was updated successfully, but these errors were encountered: