You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
During prerender, paths and endpoints that are linked to on a page get crawled. But the ones in <meta> tags do not. This means that just linking to an endpoint with <meta name="og:image" content="/og/post-1.jpg" > is not enough to cause it to be included in the prerender.
This makes stuff like programmatic social-images way more complex, since we cannot simply prerender a dynamic endpoint into image files.
The challenge with solving this
It's not possible to simply treat all content attributes on meta tags as links, since they often aren't, and there is no way to differentiate between urls and strings just from the content attribute. Whether or not the content attribute contains an url depends on the name attribute.
This means that SvelteKit would need to maintain a "whitelist" of which name attributes on meta tags should cause the content attributes the be crawled. However, since the list of meta tags rarely changes, the maintenance burden would probably be minimal.
I've prototyped an implementation of this, and would be happy to submit a PR if people agree with the described behaviour.
Error: The following routes were marked as prerenderable, but were not prerendered because they were not found while crawling your app:
- /og/[image].jpg
See https://kit.svelte.dev/docs/page-options#prerender-troubleshooting for info on how to solve this
at prerender (file:///Users/sigrist/Desktop/sk-social-image-prerender-reproduction/node_modules/@sveltejs/kit/src/core/postbuild/prerender.js:470:9)
at async process.<anonymous> (file:///Users/sigrist/Desktop/sk-social-image-prerender-reproduction/node_modules/@sveltejs/kit/src/utils/fork.js:25:17)
Describe the bug
The Problem
During prerender, paths and endpoints that are linked to on a page get crawled. But the ones in
<meta>
tags do not. This means that just linking to an endpoint with<meta name="og:image" content="/og/post-1.jpg" >
is not enough to cause it to be included in the prerender.This makes stuff like programmatic social-images way more complex, since we cannot simply prerender a dynamic endpoint into image files.
The challenge with solving this
It's not possible to simply treat all
content
attributes onmeta
tags as links, since they often aren't, and there is no way to differentiate between urls and strings just from thecontent
attribute. Whether or not thecontent
attribute contains an url depends on thename
attribute.This means that SvelteKit would need to maintain a "whitelist" of which
name
attributes on meta tags should cause thecontent
attributes the be crawled. However, since the list ofmeta
tags rarely changes, the maintenance burden would probably be minimal.I've prototyped an implementation of this, and would be happy to submit a PR if people agree with the described behaviour.
Reproduction
https://github.com/LorisSigrist/sk-social-image-prerender-reproduction
Logs
System Info
Severity
serious, but I can work around it
Additional Information
No response
The text was updated successfully, but these errors were encountered: