-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reduce size of static files #297
Comments
This patch introduced a problem that
So the thumbnail will be It can be fixed by the method mentioned above
The drawback is that thumbnails are raw images and not optimized. We may need a better solution, or adopt this one and optimize it later. |
An update to set thumbnails to raw images on github was proposed at #317, but we can have a talk to find a better solution |
Sounds like that a image hosting service could be a solution? But that requires repalcing all existing images and it's not convenient to create new blog |
Yes, using an external host does work but requires extra actions to sync them to the host. In fact, the GitHub was used as the image host/CDN. In the education repo, all images are submitted to the repo so they can be visited by github url However, GitHub doesn't have image optimization(AFAIK), so the homepage of knowledge base loads a lot of data because all covers are raw images. It works, but not ideal |
I've visited the preview page in #317, it's not that fast to load cover images, but I think it's a good patch if it meets the requirements for now. |
I have just compared the data size, the one patched loaded 25.2MB images while the original one loaded 626kB. I think loading 25MB on visiting a page is a bit crazy 😱 |
If we need a standardized solution, I think it would be better to move education_hub_articles out of public and automatically update it to a CDN supported by nextjs images (https://nextjs.org/docs/pages/building-your-application/optimizing/images#remote-images) during deployment. |
I think it's the only correct solution. Here's the list of image hosts to use |
I've merged the patch first because there're articles updated daily. An improvement was added to the patch that the raw images on GitHub will be fetched as a fallback to the optimized images on vercel. That means, most thumbnails on the It keeps everything working while reduces the data loaded from github. |
The server-rendered page Ref:
|
This issue comes from the error at https://github.com/NervosEducationHub/EducationHubArticles/actions/runs/5763474768/job/15625346948#step:6:19
It happened because the whole
public
folder(https://github.com/Magickbase/nervos-official-website/tree/develop/public) was uploaded to the serverless function. There's a sub-module namededucation_hub_articles
pointing to https://github.com/NervosEducationHub/, which includes all raw files of markdown and images to generate article pages of theknowledge-base
.All the markdown files and images can be removed after article pages are generated. However, the homepage of
knowledge-base
is server-rendered, so it fetches these raw files in the serverless function.Before this hack(5668c0d), all the markdown files are uploaded to the server less function for the server-rendered page. This hack removed images from the serverless function, and reused cover images from the statically generated article pages(5668c0d#diff-a8b84b632042488f87d04ecb12cd92cca82964a9583b052b715850cffcc1c5a5R30)
It should be fixed by a proper way:
knowledge-base
If @zhangyouxin @WhiteMinds have any better idea, please share in this issue
The text was updated successfully, but these errors were encountered: