question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ability to prerender to `about.html` instead of `about/index.html` like Sapper

See original GitHub issue

Describe the bug When setting tralilingSlash: 'ignore' then the static adapter generates wrong files, e.g.

  • blog/hello-world.html.svelte is generated as blog/hello-world.html/index.html
  • about.svelte is generated as about/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-issue

The 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 as about.html

Information about your SvelteKit Installation:

  • The repo was freshly created with npm init svelte@next .
  • yarn add -D @sveltejs/adapter-node@next to install the static adapter

Severity 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.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:3
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

8reactions
Conduitrycommented, May 13, 2021

A recent-ish new feature in Sapper was to have foo.html.svelte render to foo.html when exporting a static site (rather than foo.html/index.html), but apparently that didn’t make its way into SvelteKit. I think that would be a reasonable enhancement.

In any case, about.svelte should never generate about.html, as they correspond to different routes (/about vs /about.html).

3reactions
bfangercommented, Jan 16, 2022

I’ve rebased PR 2632, any feedback that prevents merging this PR would be appreciated.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Page options • Docs • SvelteKit
By default, SvelteKit will render (or prerender) any component first on the server and send it to the client as HTML. It will...
Read more >
Link types: prerender - HTML: HyperText Markup Language
The prerender keyword for the rel attribute of the element is a hint to browsers that the user might need the target resource...
Read more >
Prerender Seamlessly Renders Javascript for Quicker Indexing
Get higher rankings by serving search engine crawlers a static HTML version of your Javascript website without compromising your customers' experience.
Read more >
Svelte build initial render to index.html file - Stack Overflow
After digging around for a while, I found out that Sapper allows you to export (render to html files instead of requiring a...
Read more >
prerender config - vite-plugin-ssr
html instead of dist/client/about/index.html . Generting a directory for each HTML file is the most reliable way for telling Static Hosts the static...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found