diff --git a/layout/_common/head.pug b/layout/_common/head.pug index 51f094a6679f8ecfa3b9fc750d488cd7da9e1300..a73d5ce48a51a0de2cb96d2497911b54e5ebaa95 100644 --- a/layout/_common/head.pug +++ b/layout/_common/head.pug @@ -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 diff --git a/layout/_common/header.pug b/layout/_common/header.pug index 2246c33e8c15d3b43c69d7f1860ed8f19eefe9a8..05ea1f42acc731d81e10235de4e72d90662cb6e9 100644 --- a/layout/_common/header.pug +++ b/layout/_common/header.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 diff --git a/layout/_common/layout.pug b/layout/_common/layout.pug index 524d4a8d9bc2a0251aba9ed7b6ddf298071f165c..4e0e2880569f66605f42c5cd255a50aa421fb11f 100644 --- a/layout/_common/layout.pug +++ b/layout/_common/layout.pug @@ -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 diff --git a/layout/_common/sidebar.pug b/layout/_common/sidebar.pug index 769b1baaed3fdc801c551f9bc102d968e165af9d..ea17fe01acadd538e7cfa08bf176daa019e9f2d7 100644 --- a/layout/_common/sidebar.pug +++ b/layout/_common/sidebar.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 diff --git a/layout/_components/recent-posts.pug b/layout/_components/recent-posts.pug index 933884a485d922d22c14fe8c13bf80106eda8e77..11ad2738ee12cb257ba6975509747b75408ba46d 100644 --- a/layout/_components/recent-posts.pug +++ b/layout/_components/recent-posts.pug @@ -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 diff --git a/layout/_mixins/posts-sort.pug b/layout/_mixins/posts-sort.pug index 428867536f56334c797c713499f42159ba774ad0..39263cd2f35ef2ed105a8760f65062b864336a07 100644 --- a/layout/_mixins/posts-sort.pug +++ b/layout/_mixins/posts-sort.pug @@ -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 diff --git a/layout/_third-party/comments/gitalk.pug b/layout/_third-party/comments/gitalk.pug index 417913857850b386f7c67ab4e9029c59fe8c4fc3..aa0e02ce2af1444b383941eb62c4c27ad9dfc5ef 100644 --- a/layout/_third-party/comments/gitalk.pug +++ b/layout/_third-party/comments/gitalk.pug @@ -1,18 +1,15 @@ - 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. diff --git a/layout/_third-party/comments/gitment.pug b/layout/_third-party/comments/gitment.pug index 2d3333428527361345f2fc398dc81632306fdb77..7a8c7a41fe523bf857aab4b299012a2205aa6c1b 100644 --- a/layout/_third-party/comments/gitment.pug +++ b/layout/_third-party/comments/gitment.pug @@ -1,13 +1,10 @@ - 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) diff --git a/layout/_third-party/comments/index.pug b/layout/_third-party/comments/index.pug index 9cd1b9e28385f32ae0f3d73812a3f9d117ce8939..cb0e66a916dee503e0653d190ee44b0f95d720b5 100644 --- a/layout/_third-party/comments/index.pug +++ b/layout/_third-party/comments/index.pug @@ -1,5 +1,5 @@ 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 diff --git a/layout/_third-party/math/index.pug b/layout/_third-party/math/index.pug index 76404ec220e384be7d921474041bd798f518a406..20afc772c47a38939c59ca7c8cd39d7a7c32d865 100644 --- a/layout/_third-party/math/index.pug +++ b/layout/_third-party/math/index.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 diff --git a/layout/_third-party/search/algolia.pug b/layout/_third-party/search/algolia.pug index 223d69ec255a602a5205493ca5308d678b250d5a..b1d6dc5b1cdd14122dc8d74756d93689862dcc8a 100644 --- a/layout/_third-party/search/algolia.pug +++ b/layout/_third-party/search/algolia.pug @@ -1,9 +1,5 @@ - 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) diff --git a/layout/post.pug b/layout/post.pug index db8f8e25cbcc268c19d8d43c9ae9af930816cd61..28f6c88bbcb441ee92b98056dc423b3648478488 100644 --- a/layout/post.pug +++ b/layout/post.pug @@ -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