Crawl follows <link rel=alternate> links in <head>, surprisingly prerendering rss feed generating endpoints #5079
Labels
bug
Something isn't working
p2-nice-to-have
SvelteKit cannot be used by a small number of people, quality of life improvements, etc.
Milestone
Describe the problem
Currently, when crawl is enabled, build will crawl seemingly any tag with a href, src, or srcset attribute, and does not contain a rel="external" attribute. Normally, these pages are prerendered:
kit/packages/kit/src/core/build/prerender/crawl.js
Line 184 in 623fa49
As a result, using an endpoint to generate dynamic data, like an rss/atom/json-feed will cause the feed endpoint to be prerendered and the resulting feed on the site to be static and frozen. That might be desirable for static site rendering, but for dynamic sites, it's a problem. It's also surprising to encounter this, because endpoints (may change with: #4093) do not seem to support the
export const prerender = bool
option. It appears the only way to ensure endpoints aren't prerendered and frozen like this is to set rel="external", disable prerendering/crawling entirely, or totally avoid outputting any tags with href/src/srcset attributes pointing to endpoints in html.While it maybe feasible to use
<link rel="alternate external" href="/path/to/feed.atom">
it feels semantically wrong because it is not an external resource, and I worry if we can really trust feed readers to have such a nuanced understanding of rel attribute semantics.Describe the proposed solution
I'm not sure what the right answer is, but here are some ideas:
<head>
/<svelte:head>
? Would this break any useful workflows? do people dynamically generate stylesheets or social media open graph type of resources through<head>
?rel="alternate"
specifically to support feeds usecase? Would this break static site builders where a static prerendered feed maybe desirable?export const prerender = false
in endpoints, and have that behaviour somehow refuse the page's inclusion in the prerender output?rel
attribute that functions the same as"external"
for svelte crawler purposes but has no other existing semantics on the web, so we can control crawler at the link level without having undesirable effects on search engines.Maybe a composite answer is good. Is it surprising that the crawler follows
<link>
's in head? I think so. Maybe crawling of<link>
tags should be opt in?<link rel="stylesheet svelte-prerender" href="/styles-compiler-endpoint.css">
maybe? Maybe it should be opt in in dynamic site builds but default on with fully static adaptors? But that feels like a messy answer.Alternatives considered
No response
Importance
would make my life easier
Additional Information
No response
The text was updated successfully, but these errors were encountered: