sveltejs / sveltejs/kit

Expand prerender crawling to improve DX

Open
#10,294 2 comments 0 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

Some common routes are not considered during crawling for pre-rendering, leading to avoidable errors for developers that they need to manually resolve by updating their svelte.config.js entries array.

Reducing these errors would smooth the developer experience and help things "just work", for more common scenarios.

Describe the proposed solution
  1. If link[rel=alternate] exists with the page HTML, include this href as a route to potentially prerender (e.g.<link rel="alternate" href="/blog/atom.xml" type="application/atom+xml" />). (Update: this one is good and crawled already.)
  2. If /robots.txt exists during the crawl, split lines and get the URL from: Sitemap: https://example.com/sitemap.xml. A valid sitemap line robots.txt will always use this exact format of Site: <fully qualified URL>. 1.) prerender the sitemap path itself if marked for prerendering, 2.) parse sitemap.xml urls to evaluate for prerendering. (/robots.txt itself is already prerendered even without updating svelte.config.js.)
<?xml version="1.0" encoding="UTF-8" ?>
  <urlset xmlns="https://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>https://example.com/</loc>
    <changefreq>daily</changefreq>
    <priority>0.7</priority>
  </url>
  <url>
    <loc>https://example.com/about</loc>
    <changefreq>daily</changefreq>
    <priority>0.7</priority>
  </url>
  <url>
    <loc>https://example.com/contact</loc>
    <changefreq>daily</changefreq>
    <priority>0.7</priority>
  </url>
</urlset>
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 by tracing the prerender crawl behavior described in the issue, then inspect how svelte.config.js entries, /robots.txt, and sitemap.xml are handled. Done means sitemap URLs discovered through a valid robots.txt Sitemap line are evaluated for prerendering, with the sitemap path itself handled as specified.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
developer-experience, web-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.