fuwari icon indicating copy to clipboard operation
fuwari copied to clipboard

[Feature]: 添加博客内容懒加载

Open Candlest opened this issue 3 months ago • 9 comments

Is your feature request related to a problem?

对于过长的文章(7259 字),需要加载 1.2s + 时间,比如 这篇文章

请问是否有添加博客内容分块懒加载的计划,或者已经有已有的实现能够提供一些链接参考!

感激不尽!

Describe the solution you'd like

询问是否有添加博客内容分块懒加载的计划,或者得到已经有已有的实现作为参考

Describe alternatives you've considered

No response

Additional context

No response

Candlest avatar Sep 24 '25 14:09 Candlest

SSG does not provide SSR-specific features such as chunk spliting, Island architecture etc... Everything is output as static data at build time.

However, it is possible to modify this template to function as SSR. Please refer to the Astro documentation for details.

L4Ph avatar Sep 24 '25 15:09 L4Ph

Build times are exponentially longer depending on the number of files and characters. While there are certainly some areas where optimizations are lacking (lots of client-side code, using Stylus and Tailwind together, etc.), the exponential nature of the build times is unavoidable.

L4Ph avatar Sep 24 '25 15:09 L4Ph

@L4Ph Thank you for your thorough explanation. ❤ I'm also a bit embarrassed by my lack of knowledge on the relevant technology.

Candlest avatar Sep 25 '25 08:09 Candlest

简单看了一下问题太多了,lighthouse的speed index日常超过5s,这是恐怖的存在

先找找看为什么加载完成之后还会再次刷新呢?

charliez0 avatar Sep 26 '25 08:09 charliez0

@charliez0

This is because there is a lot of client JS and wasm loading such as Pagefind is inserted. If improvements can be made, I would like them to be made, but I think it will be difficult to make improvements without making major changes in the current situation.

L4Ph avatar Sep 26 '25 09:09 L4Ph

@charliez0

This is because there is a lot of client JS and wasm loading such as Pagefind is inserted. If improvements can be made, I would like them to be made, but I think it will be difficult to make improvements without making major changes in the current situation.

yeah, however if you like, switch swup to astro‘s native ClientRouter would be benifit a lot https://docs.astro.build/en/guides/view-transitions/

charliez0 avatar Sep 26 '25 09:09 charliez0

@charliez0 This is because there is a lot of client JS and wasm loading such as Pagefind is inserted. If improvements can be made, I would like them to be made, but I think it will be difficult to make improvements without making major changes in the current situation.

yeah, however if you like, switch swup to astro‘s native ClientRouter would be benifit a lot https://docs.astro.build/en/guides/view-transitions/

我觉得用 ViewTransition 目前是不可行的,除非放弃 Firefox 用户的体验。就算放弃 Firefox 用户,动画也不一定能 100% 还原,还要解决其他问题。这里转载一下 Saica 的原话:

早期版本还真是用 ViewTransition 的,大概是去年三月四月才换成 swup

几方面原因吧,首先 VT 这东西太新了,浏览器支持率不够,到现在 Firefox 也还是不支持,去年那时候连 Safari 都不支持。然后相关的资料也少,我去年想自定义 VT 的动画但我几乎找不到能读得懂的文档或者教程

不过最主要的原因可能还是我对 VT 能实现什么样的效果没有信心,VT 始终只是给两个静态网页之间加了点过渡动画而不是真正的 SPA,限制理应会更多。比如当时遇到一个可能无解的问题:VT 过渡过程中整个网页的控件都是不可用的,这点在视觉上非常明显,也是我最后把已经写好的 VT 换成 Swup 的最直接的原因

有关 VT 的兼容性,参见 https://developer.mozilla.org/en-US/docs/Web/API/ViewTransition#browser_compatibility

Xeonzilla avatar Sep 26 '25 12:09 Xeonzilla

astro有针对不支持浏览器的fallback,你之前是手动支持的呢还是用astro实现的呢?

charliez0 avatar Sep 27 '25 03:09 charliez0

It doesn't really matter whether there is a fallback or not. What saicaca cares about is that there are animations that are only supported by swup.

If you don't need swup, you can just remove it from your own repository.

L4Ph avatar Sep 27 '25 04:09 L4Ph