This is an automated email from the ASF dual-hosted git repository.
lidongdai pushed a commit to branch master
in repository
https://gitbox.apache.org/repos/asf/incubator-dolphinscheduler-website.git
The following commit(s) were added to refs/heads/master by this push:
new 02e2706 Fix html cache and check copyToDist exist (#304)
02e2706 is described below
commit 02e270678022b1f07f154296c3eba8bd7a2143ec
Author: Shiwen Cheng <[email protected]>
AuthorDate: Tue Mar 16 12:28:19 2021 +0800
Fix html cache and check copyToDist exist (#304)
* Fix html cache by .htaccess
* Check copyToDist exist
---
.htaccess | 23 +++++++++++++++++++++++
gulpfile.js | 4 +++-
site_config/site.js | 2 +-
template.ejs | 3 ---
4 files changed, 27 insertions(+), 5 deletions(-)
diff --git a/.htaccess b/.htaccess
new file mode 100644
index 0000000..3d90747
--- /dev/null
+++ b/.htaccess
@@ -0,0 +1,23 @@
+RedirectMatch 404 /\.htaccess
+
+<FilesMatch "\.html$">
+ FileETag None
+ Header unset ETag
+ Header unset Pragma
+ Header unset Cache-Control
+ Header set Cache-Control "no-cache, no-store, must-revalidate"
+ Header set Pragma "no-cache"
+ Header set Expires "Thu, 1 Jan 1970 00:00:00 GMT"
+</FilesMatch>
+
+<IfModule mod_expires.c>
+ ExpiresActive on
+ ExpiresByType text/html "access plus 0 seconds"
+ ExpiresByType image/png "access plus 1 day"
+ ExpiresByType image/jpg "access plus 1 day"
+ ExpiresByType image/jpeg "access plus 1 day"
+ ExpiresByType text/css "access plus 1 day"
+ ExpiresByType application/javascript "access plus 1 day"
+ ExpiresByType application/json "access plus 1 day"
+ ExpiresDefault "access plus 10 days"
+</IfModule>
\ No newline at end of file
diff --git a/gulpfile.js b/gulpfile.js
index 1960ae9..4c92104 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -107,7 +107,9 @@ gulp.task('post-build', (callback) => {
fs.removeSync(path.join(distdir, 'build/manifest.json'), { force: true });
if (Array.isArray(siteConfig.copyToDist)) {
siteConfig.copyToDist.forEach((item) => {
- fs.copySync(path.join(__dirname, item), path.join(distdir, item));
+ if (fs.existsSync(path.join(__dirname, item))) {
+ fs.copySync(path.join(__dirname, item), path.join(distdir, item));
+ }
});
}
fs.copySync(path.join(distdir, siteConfig.defaultLanguage, 'index.html'),
path.join(distdir, 'index.html'));
diff --git a/site_config/site.js b/site_config/site.js
index 7118d4c..b41e3dd 100644
--- a/site_config/site.js
+++ b/site_config/site.js
@@ -3,7 +3,7 @@ export default {
rootPath: '', // 发布到服务器的根目录,需以/开头但不能有尾/,如果只有/,请填写空字符串
port: 8080, // 本地开发服务器的启动端口
domain: 'dolphinscheduler.incubator.apache.org', // 站点部署域名,无需协议和path等
- copyToDist: ['img', 'file', '.asf.yaml', 'sitemap.xml', '.nojekyll'], //
当build发布时,需要额外复制到dist目录的资源,默认有:index.html, 404.html, en-us, zh-cn, build
+ copyToDist: ['img', 'file', '.asf.yaml', 'sitemap.xml', '.nojekyll',
'.htaccess'], // 当build发布时,需要额外复制到dist目录的资源,默认有:index.html, 404.html, en-us,
zh-cn, build
docsLatest: '1.3.5', // docs的最新版本,当docs有多个版本时支持latest访问,空则不启用此特性
defaultSearch: 'google', // 默认搜索引擎,baidu或者google
defaultLanguage: 'en-us',
diff --git a/template.ejs b/template.ejs
index 948d07f..e7e431f 100644
--- a/template.ejs
+++ b/template.ejs
@@ -5,9 +5,6 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0,
maximum-scale=1.0, user-scalable=no">
<meta name="keywords" content="<%= keywords %>">
<meta name="description" content="<%= description %>">
- <meta http-equiv="Cache-Control" content="no-cache, no-store,
must-revalidate">
- <meta http-equiv="Pragma" content="no-cache">
- <meta http-equiv="Expires" content="0">
<title><%= title %></title>
<link rel="shortcut icon" href="<%= rootPath %>/img/favicon.ico">
<%_ if (vendorCssPath) { _%>