apache / apisix-website

Apache APISIX Website
https://apisix.apache.org/
Apache License 2.0
127 stars 179 forks source link

support jsDelivr to speedup static files #266

Closed juzhiyuan closed 3 years ago

juzhiyuan commented 3 years ago

Hi, after https://github.com/apache/apisix-website/pull/260 is merged, we have all logos inside our repository, and now when users visit apisix.apache.org , all logos will serve from GitHub, we need to speedup those files.

Solution

  1. visit https://www.jsdelivr.com/?docs=gh to know what jsDelivr does;
  2. update https://github.com/apache/apisix-website/blob/master/website/src/pages/index.js#L123 src prop with jsDelivr . All files are under https://github.com/apache/apisix-website/tree/master/website/static/img/showcase this folder.
stu01509 commented 3 years ago

I would like to try this :)

juzhiyuan commented 3 years ago

not hard AFAIK, but it will speedup the website 😄

stu01509 commented 3 years ago

I think we need to change the static image to https://cdn.jsdelivr.net/gh/apache/apisix-website@master/website/static/img/showcase/163.png right?

juzhiyuan commented 3 years ago

ya

juzhiyuan commented 3 years ago

that's right

juzhiyuan commented 3 years ago

How about doing something like src={"https://xxx/" + "163.png"}, no need to update json file

stu01509 commented 3 years ago

Sure, I will do it later

stu01509 commented 3 years ago

Also, Could I define the global variables to store the https://cdn.jsdelivr.net/gh/apache/apisix-website@master/, What do you think?

juzhiyuan commented 3 years ago

sure, and you could use docusarus.config.js to do that? would better if possible