提交 fc4f6b67 编写于 作者: EvanOne(文一)'s avatar EvanOne(文一)

refactor: Adjust the introduction of external resource files

上级 e23f6bf9
......@@ -37,13 +37,13 @@ if theme.pwa && theme.pwa.enable
link(rel="manifest" href=`${url_for(theme.pwa.manifest)}?v=${stun_env("version")}`)
if theme.favicon.small
link(rel="icon" type="image/png" sizes="16x16" href=`${url_for(theme.favicon.small)}?v=${stun_env("version")}`)
link(rel="icon" href=`${url_for(theme.favicon.small)}?v=${stun_env("version")}` type="image/png" sizes="16x16")
if theme.favicon.medium
link(rel="icon" type="image/png" sizes="32x32" href=`${url_for(theme.favicon.medium)}?v=${stun_env("version")}`)
link(rel="icon" href=`${url_for(theme.favicon.medium)}?v=${stun_env("version")}` type="image/png" sizes="32x32")
if theme.favicon.apple_touch_icon
link(rel="apple-touch-icon" sizes="180x180" href=`${url_for(theme.favicon.apple_touch_icon)}?v=${stun_env("version")}`)
link(rel="apple-touch-icon" href=`${url_for(theme.favicon.apple_touch_icon)}?v=${stun_env("version")}` sizes="180x180")
if theme.favicon.safari_pinned_tab
link(rel="mask-icon" href=`${url_for(theme.favicon.safari_pinned_tab)}?v=${stun_env("version")}` color="#54bcff")
......@@ -53,24 +53,34 @@ if theme.favicon.msapplication
meta(name="msapplication-TileColor" content="#000000")
if theme.feed && theme.feed.rss
link(rel="alternate", href=url_for(theme.feed.rss), type="application/atom+xml")
link(rel="alternate" href=url_for(theme.feed.rss) type="application/atom+xml")
link(rel="dns-prefetch" href="https://cdn.jsdelivr.net")
- var fontawesome_css = 'https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css'
- var fontawesome_css = "https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css"
- if (theme.cdn.fontawesome_css) fontawesome_css = theme.cdn.fontawesome_css
link(rel="stylesheet" href=fontawesome_css)
link(rel="stylesheet" href=fontawesome_css type="text/css")
if theme.fancybox
- var fancybox_css = 'https://cdn.jsdelivr.net/gh/fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.css'
- var fancybox_css = "https://cdn.jsdelivr.net/gh/fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.css"
- if (theme.cdn.fontawesome) fancybox_css = theme.cdn.fontawesome
link(rel="stylesheet" href=fancybox_css)
link(rel="stylesheet" href=fancybox_css type="text/css")
if page.comments
if theme.gitalk && theme.gitalk.enable
- var gitalk_css = "https://cdn.jsdelivr.net/npm/gitalk@latest/dist/gitalk.min.css"
- if (theme.cdn.gitalk_css) gitalk_css = theme.cdn.gitalk_css
link(rel="stylesheet" href=gitalk_css type="text/css")
else if theme.gitment && theme.gitment.enable
- var gitment_css = "https://cdn.jsdelivr.net/npm/gitment/style/default.min.css"
- if (theme.cdn.gitment_css) gitment_css = theme.cdn.gitment_css
link(rel="stylesheet" href=gitment_css type="text/css")
if theme.algolia_search.enable
- var instantsearch_css = "https://cdn.jsdelivr.net/npm/instantsearch.js@2.1.1/dist/instantsearch.min.css"
- if (theme.cdn.instantsearch_css) instantsearch_css = theme.cdn.instantsearch_css
link(rel="stylesheet" href=instantsearch_css type="text/css")
link(rel="stylesheet" href=`${url_for(theme.css)}/index.css?v=${stun_env("version")}`)
include ../_third-party/analytics/index.pug
include ../_third-party/search/index.pug
include ../_third-party/comments/index.pug
include ../_third-party/math/index.pug
include ../_third-party/advertising/index.pug
include ./config.pug
......@@ -19,9 +19,9 @@ header#header(
div.header-nav-menu
each value, name in (theme.menu || [])
if name && value
- var menuItem = value.split('||')
- var menuItemPath = _.trim(_.get(menuItem, '[0]'))
- var menuItemIcon = _.trim(_.get(menuItem, '[1]'))
- var menuItem = value.split("||")
- var menuItemPath = _.trim(_.get(menuItem, "[0]"))
- var menuItemIcon = _.trim(_.get(menuItem, "[1]"))
span
a(href=menuItemPath ? menuItemPath : "/")
if !theme.menu_settings.text_only
......
......@@ -14,3 +14,9 @@ html(lang=config.language)
include ../_components/search/index.pug
include ../_scripts/cdn.pug
include ../_scripts/common.pug
include ../_third-party/quicklink.pug
include ../_third-party/advertising/index.pug
include ../_third-party/analytics/index.pug
include ../_third-party/comments/index.pug
include ../_third-party/math/index.pug
include ../_third-party/search/index.pug
......@@ -24,13 +24,13 @@ aside#sidebar
div.sidebar-social
for value, name in (theme.social || [])
if name && value
- var socialItem = value.split('||')
- var socialLinkPath = _.trim(_.get(socialItem, '[0]'))
- var socialLinkIcon = _.trim(_.get(socialItem, '[1]'))
- var socialItem = value.split("||")
- var socialLinkPath = _.trim(_.get(socialItem, "[0]"))
- var socialLinkIcon = _.trim(_.get(socialItem, "[1]"))
span.sidebar-social-item
a(href=socialLinkPath target="_blank" rel="noopener"
data-popover=_p(`social.${name}`) data-popover-pos=`${
theme.social_setting.icon_only ? 'up' : 'none'}`)
theme.social_setting.icon_only ? "up" : "none"}`)
if socialLinkIcon && socialLinkIcon.match("origin:")
span!= socialLinkIcon.split("origin:")[1]
......@@ -60,9 +60,9 @@ aside#sidebar
span= _p("sidebar.subscribe")
if theme.menu
- var menuArchives = _.trim(_.get(theme.menu.archives.split('||'), '[0]'))
- var menuCategories = _.trim(_.get(theme.menu.categories.split('||'), '[0]'))
- var menuTags = _.trim(_.get(theme.menu.tags.split('||'), '[0]'))
- var menuArchives = _.trim(_.get(theme.menu.archives.split("||"), "[0]"))
- var menuCategories = _.trim(_.get(theme.menu.categories.split("||"), "[0]"))
- var menuTags = _.trim(_.get(theme.menu.tags.split("||"), "[0]"))
div.sidebar-state
if theme.menu.archives
span.sidebar-state-item.sidebar-state-posts
......
......@@ -3,7 +3,7 @@ section#recent-posts.recent-posts
- var postLists = theme.post_list.paginate.home ? page.posts : site.posts
- postLists.each(function (post) {
article(class=`${post.link ? 'post-link' : ''}`).post
article(class=`${post.link ? "post-link" : ""}`).post
+postHeader(post)
div.post-body
......@@ -16,7 +16,7 @@ section#recent-posts.recent-posts
if theme.auto_excerpt && theme.auto_excerpt.enable
- const content = strip_html(post.content)
- var excerpt = content.substring(0, theme.auto_excerpt.length)
- content.length > theme.auto_excerpt.length ? excerpt += '......' : ''
- content.length > theme.auto_excerpt.length ? excerpt += "......" : ""
div!= excerpt
else if post.excerpt
div.post-excerpt!= post.excerpt
......
......@@ -16,7 +16,7 @@ mixin articleSort(posts)
if post.link
a(href=url_for(post.link) target="_blank" rel="noopener")= post.title || post.link
else
a(href=url_for(post.path))= post.title || _p('post.untitled')
a(href=url_for(post.path))= post.title || _p("post.untitled")
if post.top
include ../_components/sticky-top.pug
......
-
var gitalk_js = "https://cdn.jsdelivr.net/npm/gitalk@latest/dist/gitalk.min.js"
var gitalk_css = "https://cdn.jsdelivr.net/npm/gitalk@latest/dist/gitalk.min.css"
var gitalk_md5 = "https://cdn.jsdelivr.net/npm/js-md5@latest/src/md5.min.js"
if (theme.cdn.gitalk_js) gitalk_js = theme.cdn.gitalk_js
if (theme.cdn.gitalk_css) gitalk_css = theme.cdn.gitalk_css
if (theme.cdn.gitalk_md5) gitalk_md5 = theme.cdn.gitalk_md5
link(href=gitalk_css rel="stylesheet" type="text/css")
script(src=gitalk_js)
script(src=gitalk_md5)
-
var lang = _.get(theme, 'gitalk.language')
var lang = _.get(theme, "gitalk.language")
? theme.gitalk.language : config.language;
script.
......
-
var gitment_js = "https://cdn.jsdelivr.net/npm/gitment/dist/gitment.browser.min.js"
var gitment_css = "https://cdn.jsdelivr.net/npm/gitment/style/default.min.css"
var gitment_md5 = "https://cdn.jsdelivr.net/npm/js-md5@latest/src/md5.min.js"
if (theme.cdn.gitment_js) gitment_js = theme.cdn.gitment_js
if (theme.cdn.gitment_css) gitment_css = theme.cdn.gitment_css
if (theme.cdn.gitment_md5) gitment_md5 = theme.cdn.gitment_md5
link(href=gitment_css rel="stylesheet" type="text/css")
script(src=gitment_js)
script(src=gitment_md5)
......
if page.comments
if theme.gitment && theme.gitment.enable
if theme.gitment && theme.gitment.enable
include ./gitment.pug
else if theme.gitalk && theme.gitalk.enable
include ./gitalk.pug
......
......@@ -9,7 +9,7 @@ if theme.math.enable
if !is_tag() && !is_category() && !is_archive()
if isHomeHasMath || (theme.math.per_page || page.math)
if theme.math.engine === 'mathjax'
if theme.math.engine === "mathjax"
include ./mathjax.pug
else if theme.math.engine === 'katex'
else if theme.math.engine === "katex"
include ./katex.pug
-
var instantsearch_js = "https://cdn.jsdelivr.net/npm/instantsearch.js@2.1.1/dist/instantsearch.min.js"
var instantsearch_css = "https://cdn.jsdelivr.net/npm/instantsearch.js@2.1.1/dist/instantsearch.min.css"
if (theme.cdn.instantsearch_js) instantsearch_js = theme.cdn.instantsearch_js
if (theme.cdn.instantsearch_css) instantsearch_css = theme.cdn.instantsearch_css
link(href=instantsearch_css rel="stylesheet" type="text/css")
script(src=instantsearch_js defer)
......@@ -20,7 +20,7 @@ block content
span= _p("post.end")
span= "------"
- let themeConfigCC = theme.creative_commons.enable && theme.creative_commons.post
- var themeConfigCC = theme.creative_commons.enable && theme.creative_commons.post
if page.copyright === false ? page.copyright : themeConfigCC
include ./_components/copyright.pug
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册