静态资源优化
This commit is contained in:
parent
e44a713f7e
commit
1330523844
|
@ -1641,6 +1641,33 @@ spec:
|
|||
- group: other
|
||||
label: 其他设置
|
||||
formSchema:
|
||||
- $formkit: group
|
||||
name: staticResource
|
||||
label: 静态资源文件设置
|
||||
value:
|
||||
use:
|
||||
cdn_link:
|
||||
children:
|
||||
- $formkit: select
|
||||
name: use
|
||||
id: use
|
||||
key: use
|
||||
label: 类型选择
|
||||
value: local
|
||||
options:
|
||||
- label: 本地
|
||||
value: local
|
||||
- label: elemecdn
|
||||
value: elemecdn
|
||||
- label: 自定义
|
||||
value: custom
|
||||
- $formkit: url
|
||||
name: cdn_link
|
||||
if: "$get(use).value == 'custom'"
|
||||
label: cdn地址,外链地址
|
||||
validation: required
|
||||
value: '(https://npm.elemecdn.com/hao-theme-static@1.1.5/templates/assets'
|
||||
help: '默认为npmJs的elemecdn加速地址,如果你有自己的cdn地址(请确保链接下assets文件夹下主题静态资源文件),可以填写,否则请勿修改! '
|
||||
- $formkit: group
|
||||
name: diytitle
|
||||
label: 动态标题
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en" th:replace="~{modules/layouts/layout :: layout(content = ~{::content}, htmlType = 'category')}"
|
||||
xmlns:th="http://www.thymeleaf.org">
|
||||
xmlns:th="http://www.thymeleaf.org"
|
||||
th:with="assets_link=${theme.config.other.staticResource.use == 'elemecdn' ? 'https://npm.elemecdn.com/hao-theme-static@' + theme.spec.version +'/templates/assets' : theme.config.other.staticResource.use == 'custom' ? theme.config.other.staticResource.cdn_link : #theme.assets('/')}">
|
||||
|
||||
<th:block th:fragment="content">
|
||||
|
||||
|
@ -24,7 +25,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<th:block th:if="${#strings.equals(theme.config.categories.use, '3D')}">
|
||||
<link rel="stylesheet" th:href="@{/assets/libs/no3d/no3d.css}">
|
||||
<link rel="stylesheet" th:href="${assets_link + '/libs/no3d/no3d.css'}">
|
||||
<div id="libCategories" >
|
||||
<div id="lib-cards" class="container" >
|
||||
<a th:each="categoryItem : ${categoryFinder.listAll()}" th:href="@{${categoryItem.status.permalink}}" th:id="${categoryItem.spec.displayName}">
|
||||
|
@ -37,7 +38,7 @@
|
|||
</div>
|
||||
<div class="js-pjax">
|
||||
<script src="https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/vue/2.6.14/vue.min.js"></script>
|
||||
<script th:src="@{/assets/libs/no3d/no3d.js}"></script>
|
||||
<script th:src="${assets_link + '/libs/no3d/no3d.js'}"></script>
|
||||
</div>
|
||||
</th:block>
|
||||
</div>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en" th:replace="~{modules/layouts/layout :: layout(content = ~{::content}, htmlType = 'fcircle')}"
|
||||
xmlns:th="http://www.thymeleaf.org">
|
||||
xmlns:th="http://www.thymeleaf.org"
|
||||
th:with="assets_link=${theme.config.other.staticResource.use == 'elemecdn' ? 'https://npm.elemecdn.com/hao-theme-static@' + theme.spec.version +'/templates/assets' : theme.config.other.staticResource.use == 'custom' ? theme.config.other.staticResource.cdn_link : #theme.assets('/')}">
|
||||
|
||||
<th:block th:fragment="content">
|
||||
|
||||
|
@ -46,7 +47,7 @@
|
|||
hungryFish: 500,
|
||||
}
|
||||
</script>
|
||||
<script th:src="@{/assets/libs/moments/random-friends-post.js}"></script>
|
||||
<script th:src="${assets_link + '/libs/moments/random-friends-post.js'}"></script>
|
||||
|
||||
</th:block>
|
||||
<!--鱼塘-->
|
||||
|
@ -69,9 +70,9 @@
|
|||
sort_rule: 'created'
|
||||
}
|
||||
</script>
|
||||
<link rel="stylesheet" th:href="@{/assets/libs/moments/heoMainColor.css}">
|
||||
<script type="text/javascript" th:src="@{/assets/libs/moments/app.min.js}"></script>
|
||||
<script type="text/javascript" th:src="@{/assets/libs/moments/bundle.js}"></script>
|
||||
<link rel="stylesheet" th:href="${assets_link + '/libs/moments/heoMainColor.css'}">
|
||||
<script type="text/javascript" th:src="${assets_link + '/libs/moments/app.min.js'}"></script>
|
||||
<script type="text/javascript" th:src="${assets_link + '/libs/moments/bundle.js'}"></script>
|
||||
|
||||
|
||||
</div>
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en" th:replace="~{modules/layouts/layout :: layout(content = ~{::content}, htmlType = 'links')}"
|
||||
xmlns:th="http://www.thymeleaf.org">
|
||||
xmlns:th="http://www.thymeleaf.org"
|
||||
th:with="assets_link=${theme.config.other.staticResource.use == 'elemecdn' ? 'https://npm.elemecdn.com/hao-theme-static@' + theme.spec.version +'/templates/assets' : theme.config.other.staticResource.use == 'custom' ? theme.config.other.staticResource.cdn_link : #theme.assets('/')}">
|
||||
<th:block th:fragment="content">
|
||||
|
||||
<div class="page" id="body-wrap">
|
||||
<header class="not-top-img" id="page-header">
|
||||
<nav th:replace="~{modules/nav :: nav(title = null)}"></nav>
|
||||
<link rel="stylesheet" type="text/css" th:href="@{/assets/zhheo/heo-fcircle3.css}">
|
||||
<link rel="stylesheet" type="text/css" th:href="${assets_link + '/zhheo/heo-fcircle3.css'}">
|
||||
|
||||
</header>
|
||||
<main class="layout hide-aside" id="content-inner">
|
||||
|
@ -69,7 +70,7 @@
|
|||
hungryFish: 500,
|
||||
}
|
||||
</script>
|
||||
<script th:src="@{/assets/libs/moments/random-friends-post.js}"></script>
|
||||
<script th:src="${assets_link + '/libs/moments/random-friends-post.js'}"></script>
|
||||
</th:block>
|
||||
|
||||
<div class="flink" id="article-container">
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en" xmlns:th="http://www.thymeleaf.org">
|
||||
<!-- 公共的 head 部分,可以定义部分 links,scripts,styles -->
|
||||
<head th:fragment="head(htmlType)">
|
||||
<head th:fragment="head(htmlType)" th:with="assets_link=${theme.config.other.staticResource.use == 'elemecdn' ? 'https://npm.elemecdn.com/hao-theme-static@' + theme.spec.version +'/templates/assets' : theme.config.other.staticResource.use == 'custom' ? theme.config.other.staticResource.cdn_link : #theme.assets('/')}">
|
||||
<meta charset="UTF-8">
|
||||
<meta content="IE=edge" http-equiv="X-UA-Compatible">
|
||||
<meta content="width=device-width,initial-scale=1" name="viewport">
|
||||
|
@ -12,21 +12,21 @@
|
|||
<link rel="shortcut icon"
|
||||
th:href="@{${#strings.isEmpty(site.favicon) ? '/assets/images/hao-logo.jpg' : site.favicon}}"/>
|
||||
|
||||
<script th:src="@{/assets/js/heo.js}"></script>
|
||||
<script th:src="${assets_link + '/js/heo.js'}"></script>
|
||||
|
||||
<script th:src="@{/assets/js/halo.js}"></script>
|
||||
<script th:src="${assets_link + '/js/halo.js'}"></script>
|
||||
|
||||
<link rel="stylesheet" th:href="@{/assets/zhheo/zhheoblog.css}">
|
||||
<link rel="stylesheet" th:href="${assets_link + '/zhheo/zhheoblog.css'}">
|
||||
|
||||
<link rel="stylesheet" th:href="@{/assets/zhheo/custom.css}">
|
||||
<link rel="stylesheet" th:href="${assets_link + '/zhheo/custom.css'}">
|
||||
|
||||
<link rel="stylesheet" th:href="@{/assets/zhheo/commentBarrage.css}">
|
||||
<link rel="stylesheet" th:href="${assets_link + '/zhheo/commentBarrage.css'}">
|
||||
|
||||
|
||||
<link media="print"
|
||||
onload='this.media="all"'
|
||||
rel="stylesheet"
|
||||
th:href="@{/assets/libs/iconfont/iconfont.css}">
|
||||
th:href="${assets_link + '/libs/iconfont/iconfont.css'}">
|
||||
|
||||
<!-- swiper 在瞬间滚动时会使用 -->
|
||||
<link rel="stylesheet" href="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/Swiper/8.0.6/swiper-bundle.min.css"/>
|
||||
|
@ -142,7 +142,7 @@
|
|||
</script>
|
||||
|
||||
<!-- 复制 https://github.com/zenorocha/clipboard.js -->
|
||||
<script th:src="@{/assets/libs/clipboard/clipboard.min.js}"></script>
|
||||
<script th:src="${assets_link + '/libs/clipboard/clipboard.min.js'}"></script>
|
||||
|
||||
<!-- 全局图片预览-->
|
||||
<script src="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/fancybox/3.5.7/jquery.fancybox.min.js"></script>
|
||||
|
@ -153,11 +153,11 @@
|
|||
<script src="https://map.qq.com/api/gljs?v=1.exp&key=YZOBZ-34HLF-K3OJV-JV6IN-OALJ5-7MBAC"></script>
|
||||
|
||||
<!-- 关于统计-->
|
||||
<script th:src="@{/assets/libs/countup/countup.js}"></script>
|
||||
<script th:src="${assets_link + '/libs/countup/countup.js'}"></script>
|
||||
|
||||
|
||||
<!-- icon图标 -->
|
||||
<link rel="stylesheet" href="https://npm.elemecdn.com/hao-theme-static@1.1.7/icon/iconfont.css">
|
||||
<link rel="stylesheet" th:href="'https://npm.elemecdn.com/hao-theme-static@'+${theme.spec.version}+'/icon/iconfont.css'">
|
||||
|
||||
<!-- 声明一些公共信息 -->
|
||||
<script id="site-config" th:inline="javascript">
|
||||
|
@ -182,6 +182,7 @@
|
|||
navMusicEnable:[[${theme.config.tool.nav_music.nav_musicEnable}]],
|
||||
isMusic: [[${ htmlType == 'music'}]],
|
||||
helloText: [[${#strings.listSplit(theme.config.sidebar.profile.helloText, ',')}]],
|
||||
assetsLink: [[${assets_link}]],
|
||||
source: {
|
||||
jQuery: 'https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/jquery/3.6.0/jquery.min.js',
|
||||
justifiedGallery: {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en" th:fragment="layout(content, htmlType)" xmlns:th="http://www.thymeleaf.org">
|
||||
<html lang="en" th:fragment="layout(content, htmlType)" xmlns:th="http://www.thymeleaf.org"
|
||||
th:with="assets_link=${theme.config.other.staticResource.use == 'elemecdn' ? 'https://npm.elemecdn.com/hao-theme-static@' + theme.spec.version +'/templates/assets' : theme.config.other.staticResource.use == 'custom' ? theme.config.other.staticResource.cdn_link : #theme.assets('/')}">
|
||||
|
||||
<!-- head 中自定义的 -->
|
||||
|
||||
|
@ -48,9 +49,9 @@
|
|||
<div th:replace="~{modules/right-menu :: right-menu}"></div>
|
||||
|
||||
<div>
|
||||
<script th:src="@{/assets/js/utils.js}"></script>
|
||||
<script th:src="@{/assets/js/main.js}"></script>
|
||||
<script charset="utf-8" data-pjax th:src="@{/assets/zhheo/blogex.js}"></script>
|
||||
<script th:src="${assets_link + '/js/utils.js'}"></script>
|
||||
<script th:src="${assets_link + '/js/main.js'}"></script>
|
||||
<script charset="utf-8" data-pjax th:src="${assets_link + '/zhheo/blogex.js'}"></script>
|
||||
|
||||
<!-- https://instant.page/ 网站预加载, 放在 </body> 之前 -->
|
||||
<script src="https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/instant.page/5.1.0/instantpage.min.js" type="module"></script>
|
||||
|
@ -63,20 +64,20 @@
|
|||
|
||||
<!-- 深色模式下添加粒子效果canvas -->
|
||||
<canvas th:if="${theme.config.style.universe}" id="universe" width="1312" height="880"></canvas>
|
||||
<script th:if="${theme.config.style.universe}" async="" th:src="@{/assets/libs/canvas/dark.js}"></script>
|
||||
<script th:if="${theme.config.style.universe}" async="" th:src="${assets_link + '/libs/canvas/dark.js'}"></script>
|
||||
|
||||
<!-- https://davidshimjs.github.io/qrcodejs/ 生成二维码 -->
|
||||
<!-- 应该是文章页分享使用 -->
|
||||
<script data-pjax src="https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/qrcodejs/1.0.0/qrcode.min.js"></script>
|
||||
|
||||
<!-- https://raphamorim.io/waterfall.js/ 应该是这个 还有相关的 js 代码 是否可以调整-->
|
||||
<script th:src="@{/assets/libs/waterfall/waterfall.min.js}"></script>
|
||||
<script th:src="${assets_link + '/libs/waterfall/waterfall.min.js'}"></script>
|
||||
|
||||
<!-- 获取主色 https://lokeshdhakar.com/projects/color-thief/ -->
|
||||
<!--<script th:src="@{/assets/libs/color-thief/color-thief.umd.js}"></script>-->
|
||||
<script th:src="@{/assets/libs/fast-average-color/index.browser.min.js}"></script>
|
||||
<script th:src="${assets_link + '/libs/fast-average-color/index.browser.min.js'}"></script>
|
||||
|
||||
<script th:src="@{/assets/libs/view-image/view-image.min.js}"></script>
|
||||
<script th:src="${assets_link + '/libs/view-image/view-image.min.js'}"></script>
|
||||
|
||||
|
||||
<!--左下角音乐-->
|
||||
|
@ -84,13 +85,13 @@
|
|||
|
||||
<link rel="stylesheet" href="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/aplayer/1.10.1/APlayer.min.css" media="all" onload="this.media='all'">
|
||||
|
||||
<script th:src="@{/assets/libs/aplayer/APlayer.min.js}"></script>
|
||||
<script th:src="${assets_link + '/libs/aplayer/APlayer.min.js'}"></script>
|
||||
|
||||
<script th:src="@{/assets/libs/aplayer/Meting2.min.js}"></script>
|
||||
<script th:src="${assets_link + '/libs/aplayer/Meting2.min.js'}"></script>
|
||||
|
||||
|
||||
|
||||
<script th:src="@{/assets/libs/pjax/pjax.min.js}"></script>
|
||||
<script th:src="${assets_link + '/libs/pjax/pjax.min.js'}"></script>
|
||||
|
||||
<!-- swiper 在瞬间滚动时会使用 -->
|
||||
<script data-pjax src="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/Swiper/8.0.6/swiper-bundle.min.js"></script>
|
||||
|
@ -99,8 +100,8 @@
|
|||
<script th:replace="~{modules/commentBarrage :: commentBarrage}"></script>
|
||||
|
||||
<!-- Tocbot 目录生成 start -->
|
||||
<script th:src="@{/assets/libs/tocbot/4.18.2/tocbot.min.js}"></script>
|
||||
<link th:href="@{/assets/libs/tocbot/4.18.2/tocbot.css}" rel="stylesheet">
|
||||
<script th:src="${assets_link + '/libs/tocbot/4.18.2/tocbot.min.js'}"></script>
|
||||
<link th:href="${assets_link + '/libs/tocbot/4.18.2/tocbot.css'}" rel="stylesheet">
|
||||
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en" xmlns:th="http://www.thymeleaf.org">
|
||||
<html lang="en" xmlns:th="http://www.thymeleaf.org"
|
||||
th:with="assets_link=${theme.config.other.staticResource.use == 'elemecdn' ? 'https://npm.elemecdn.com/hao-theme-static@' + theme.spec.version +'/templates/assets' : theme.config.other.staticResource.use == 'custom' ? theme.config.other.staticResource.cdn_link : #theme.assets('/')}">
|
||||
<!-- 右键菜单 -->
|
||||
<div th:fragment="right-menu" th:if="${theme.config.tool.rightMenu.rightMenuEnable}">
|
||||
<script th:src="@{/assets/zhheo/rightmenu.js}"></script>
|
||||
<script th:src="${assets_link + '/zhheo/rightmenu.js'}"></script>
|
||||
<div id="rightMenu">
|
||||
<div class="rightMenu-group rightMenu-small">
|
||||
<div class="rightMenu-item" id="menu-backward"><i class="iconfont icon-arrow-left"></i></div>
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
setTimeout(runFn, 0)
|
||||
return
|
||||
}
|
||||
getScript(GLOBAL_CONFIG.twikoo.js).then(runFn)
|
||||
getScript(GLOBAL_CONFIG.source.twikoo.js).then(runFn)
|
||||
}
|
||||
|
||||
if ('Twikoo' === 'Twikoo' || !false) {
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
if (typeof twikoo === 'object') {
|
||||
runTwikoo()
|
||||
} else {
|
||||
getScript('/themes/theme-hao/assets/libs/twikoo/twikoo.all.min.js').then(runTwikoo)
|
||||
getScript(GLOBAL_CONFIG.source.twikoo.js).then(runTwikoo)
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
if (typeof twikoo === 'object') {
|
||||
runTwikoo()
|
||||
} else {
|
||||
getScript(GLOBAL_CONFIG.twikoo.js).then(runTwikoo)
|
||||
getScript(GLOBAL_CONFIG.source.twikoo.js).then(runTwikoo)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en" th:replace="~{modules/layouts/layout :: layout(content = ~{::content}, htmlType = 'music')}"
|
||||
xmlns:th="http://www.thymeleaf.org">
|
||||
xmlns:th="http://www.thymeleaf.org"
|
||||
th:with="assets_link=${theme.config.other.staticResource.use == 'elemecdn' ? 'https://npm.elemecdn.com/hao-theme-static@' + theme.spec.version +'/templates/assets' : theme.config.other.staticResource.use == 'custom' ? theme.config.other.staticResource.cdn_link : #theme.assets('/')}">
|
||||
|
||||
<th:block th:fragment="content">
|
||||
|
||||
|
@ -26,7 +27,7 @@
|
|||
</div>
|
||||
|
||||
|
||||
<link rel="stylesheet" th:href="@{/assets/libs/aplayer/music.css}" >
|
||||
<link rel="stylesheet" th:href="${assets_link + '/libs/aplayer/music.css'}" >
|
||||
|
||||
|
||||
</main>
|
||||
|
|
|
@ -31,5 +31,5 @@ spec:
|
|||
repo: https://github.com/liuzhihang/halo-theme-hao
|
||||
settingName: "theme-hao-setting"
|
||||
configMapName: "theme-hao-configMap"
|
||||
version: "1.1.6"
|
||||
version: "1.1.5"
|
||||
require: ">=2.0.0"
|
||||
|
|
Loading…
Reference in New Issue