sveltejs / sveltejs/kit

Dynamic SSR per request

Open
#12,941 17 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
20.8k
Forks
2.3k
Avg merge
1d 16h
Merged PRs (30d)
156

Description

Describe the problem

before i could enable/disable SSR per request from hooks, now its not possible. I don't really need SSR for my app but for SEO its better to be enabled.

Describe the proposed solution

can we override export const ssr = false/true from hooks as it was before? so if I detect bot crawling I will return SSR true from hooks.

export function handle({ event, resolve }) {

let ssr = false;
if(bot){
   ssr=true
}

return resolve(event, {
ssr
});

Alternatives considered

No response

Importance

nice to have

Additional Information

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the handle hook and the resolve(event, { ssr }) example described in the issue, then trace how SSR settings are currently applied per request. Done means establishing whether hooks can control SSR dynamically for bot requests and covering the supported behavior with tests and documentation.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.