This is an automated email from the ASF dual-hosted git repository.

sunyi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-website.git


The following commit(s) were added to refs/heads/master by this push:
     new f60dbaa  feat: support using jsDelivr in ssrTemplate (#669)
f60dbaa is described below

commit f60dbaa473a16bfd2ffec5b285985623beaa40a6
Author: 琚致远 <[email protected]>
AuthorDate: Sun Oct 24 00:10:32 2021 +0800

    feat: support using jsDelivr in ssrTemplate (#669)
---
 website/config/ssrTemplate.js                  |  35 +++++++++++++++++++++++++
 website/docusaurus.config.js                   |   9 ++++++-
 website/src/assets/videos/apisix.mp4           | Bin 6004471 -> 0 bytes
 website/src/css/customTheme.css                |  10 +++----
 website/src/pages/sections/opensourcePromo.jsx |   5 +---
 5 files changed, 49 insertions(+), 10 deletions(-)

diff --git a/website/config/ssrTemplate.js b/website/config/ssrTemplate.js
new file mode 100644
index 0000000..43f5ea7
--- /dev/null
+++ b/website/config/ssrTemplate.js
@@ -0,0 +1,35 @@
+const CDN_URL = 'https://cdn.jsdelivr.net/gh/apache/apisix-website@asf-site'
+
+module.exports = {
+  ssrTemplate: `<!DOCTYPE html>
+  <html <%~ it.htmlAttributes %>>
+    <head>
+      <meta charset="UTF-8">
+      <meta name="viewport" content="width=device-width, initial-scale=1.0">
+      <meta name="generator" content="Docusaurus v<%= it.version %>">
+      <% if (it.noIndex) { %>
+        <meta name="robots" content="noindex, nofollow" />
+      <% } %>
+      <%~ it.headTags %>
+      <% it.metaAttributes.forEach((metaAttribute) => { %>
+        <%~ metaAttribute %>
+      <% }); %>
+      <% it.stylesheets.forEach((stylesheet) => { %>
+        <link rel="stylesheet" href="${CDN_URL}<%= it.baseUrl %><%= stylesheet 
%>" />
+      <% }); %>
+      <% it.scripts.forEach((script) => { %>
+        <link rel="preload" href="${CDN_URL}<%= it.baseUrl %><%= script %>" 
as="script">
+      <% }); %>
+    </head>
+    <body <%~ it.bodyAttributes %>>
+      <%~ it.preBodyTags %>
+      <div id="__docusaurus">
+        <%~ it.appHtml %>
+      </div>
+      <% it.scripts.forEach((script) => { %>
+        <script src="<%= it.baseUrl %><%= script %>"></script>
+      <% }); %>
+      <%~ it.postBodyTags %>
+    </body>
+  </html>`
+}
diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js
index d1aade9..081a032 100644
--- a/website/docusaurus.config.js
+++ b/website/docusaurus.config.js
@@ -1,8 +1,10 @@
+const { ssrTemplate } = require('./config/ssrTemplate');
+
 module.exports = {
   title: "Apache APISIX® --  Cloud-Native API Gateway",
   tagline:
     "Apache APISIX is a dynamic, real-time, high-performance Cloud-Native API 
gateway, based on the Nginx library and etcd.",
-  url: "https://apisix.apache.org/";,
+  url: "https://apisix.apache.org";,
   baseUrl: "/",
   organizationName: "Apache",
   projectName: "apisix-website",
@@ -640,4 +642,9 @@ module.exports = {
   stylesheets: [
     
"https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap";,
   ],
+  /**
+   * We need to check if we build site for preview env, or preview site will 
load static assets from the asf-site branch.
+   * See ssrTemplate -> jsDelivr
+  */
+   ssrTemplate
 };
diff --git a/website/src/assets/videos/apisix.mp4 
b/website/src/assets/videos/apisix.mp4
deleted file mode 100644
index 8478ba9..0000000
Binary files a/website/src/assets/videos/apisix.mp4 and /dev/null differ
diff --git a/website/src/css/customTheme.css b/website/src/css/customTheme.css
index c1a76d8..2bf3ca6 100644
--- a/website/src/css/customTheme.css
+++ b/website/src/css/customTheme.css
@@ -54,27 +54,27 @@ html[data-theme="dark"] {
 
 @font-face {
   font-family: 'MaisonNeue-Medium';
-  src: local('MaisonNeue-Medium'), url(../fonts/MaisonNeue-Medium.otf) 
format('opentype');
+  src: local('MaisonNeue-Medium'), 
url(https://cdn.jsdelivr.net/gh/apache/apisix-website@master/website/src/fonts/MaisonNeue-Medium.otf)
 format('opentype');
   font-display: swap;
 }
 @font-face {
   font-family: 'MaisonNeue-Bold';
-  src: local('MaisonNeue-Bold'), url(../fonts/MaisonNeue-Bold.otf) 
format('opentype');
+  src: local('MaisonNeue-Bold'), 
url(https://cdn.jsdelivr.net/gh/apache/apisix-website@master/website/src/fonts/MaisonNeue-Bold.otf)
 format('opentype');
   font-display: swap;
 }
 @font-face {
   font-family: 'MaisonNeue-Light';
-  src: local('MaisonNeue-Light'), url(../fonts/MaisonNeue-Light.otf) 
format('opentype');
+  src: local('MaisonNeue-Light'), 
url(https://cdn.jsdelivr.net/gh/apache/apisix-website@master/website/src/fonts/MaisonNeue-Light.otf)
 format('opentype');
   font-display: swap;
 }
 @font-face {
   font-family: 'MaisonNeue-Demi';
-  src: local('MaisonNeue-Demi'), url(../fonts/MaisonNeue-Demi.otf) 
format('opentype');
+  src: local('MaisonNeue-Demi'), 
url(https://cdn.jsdelivr.net/gh/apache/apisix-website@master/website/src/fonts/MaisonNeue-Demi.otf)
 format('opentype');
   font-display: swap;
 }
 @font-face {
   font-family: 'MaisonNeue-ExtraBold';
-  src: local('MaisonNeue-ExtraBold'), url(../fonts/MaisonNeue-ExtraBold.otf) 
format('opentype');
+  src: local('MaisonNeue-ExtraBold'), 
url(https://cdn.jsdelivr.net/gh/apache/apisix-website@master/website/src/fonts/MaisonNeue-ExtraBold.otf)
 format('opentype');
   font-display: swap;
 }
 
diff --git a/website/src/pages/sections/opensourcePromo.jsx 
b/website/src/pages/sections/opensourcePromo.jsx
index 9bd3726..fb999fc 100644
--- a/website/src/pages/sections/opensourcePromo.jsx
+++ b/website/src/pages/sections/opensourcePromo.jsx
@@ -7,9 +7,6 @@ import OssCanvas from "./components/ossCanvas"
 import "../../css/customTheme.css";
 import GitHub from "../../assets/icons/github-logo.svg";
 
-// TODO: Load Video from YouTube
-import YtPromo from "../../assets/videos/apisix.mp4";
-
 const OpensourcePromo = (props) => {
   return (
     <>
@@ -23,7 +20,7 @@ const OpensourcePromo = (props) => {
             </div>
           </div>
           <div className="docs-promo-video">
-            <video preload="none" src={YtPromo} loading="lazy" autoPlay={true} 
poster="" muted={true} loop={true} width="70%" height="auto" controls></video>
+            <video preload="none" 
src="https://static.apiseven.com/apisix-website/videos/apisix.mp4"; 
loading="lazy" autoPlay={true} poster="" muted={true} loop={true} width="70%" 
height="auto" controls></video>
           </div>
         </div>
       

Reply via email to