hexo-theme-fluid 1.8.13 → 1.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. package/LICENSE +674 -21
  2. package/README.md +17 -21
  3. package/_config.yml +164 -79
  4. package/languages/de.yml +58 -33
  5. package/languages/en.yml +58 -33
  6. package/languages/eo.yml +58 -33
  7. package/languages/es.yml +69 -0
  8. package/languages/ja.yml +58 -33
  9. package/languages/zh-CN.yml +58 -33
  10. package/languages/zh-HK.yml +69 -0
  11. package/languages/zh-TW.yml +58 -33
  12. package/layout/.DS_Store +0 -0
  13. package/layout/404.ejs +3 -1
  14. package/layout/{_partial → _partials}/archive-list.ejs +4 -4
  15. package/layout/_partials/category-chains.ejs +19 -0
  16. package/layout/_partials/category-list.ejs +62 -0
  17. package/layout/{_partial → _partials}/comments/changyan.ejs +0 -0
  18. package/layout/{_partial → _partials}/comments/cusdis.ejs +0 -0
  19. package/layout/{_partial → _partials}/comments/disqus.ejs +0 -0
  20. package/layout/_partials/comments/giscus.ejs +36 -0
  21. package/layout/{_partial → _partials}/comments/gitalk.ejs +0 -0
  22. package/layout/{_partial → _partials}/comments/livere.ejs +0 -0
  23. package/layout/{_partial → _partials}/comments/remark42.ejs +0 -0
  24. package/layout/{_partial → _partials}/comments/twikoo.ejs +3 -1
  25. package/layout/{_partial → _partials}/comments/utterances.ejs +1 -1
  26. package/layout/{_partial → _partials}/comments/valine.ejs +3 -1
  27. package/layout/{_partial → _partials}/comments/waline.ejs +6 -3
  28. package/layout/_partials/comments.ejs +5 -0
  29. package/layout/_partials/css.ejs +26 -0
  30. package/layout/_partials/footer/beian.ejs +33 -0
  31. package/layout/_partials/footer/statistics.ejs +39 -0
  32. package/layout/_partials/footer.ejs +18 -0
  33. package/layout/{_partial → _partials}/head.ejs +7 -1
  34. package/layout/_partials/header/banner.ejs +33 -0
  35. package/layout/{_partial/nav.ejs → _partials/header/navigation.ejs} +3 -2
  36. package/layout/_partials/header.ejs +8 -0
  37. package/layout/{_partial → _partials}/paginator.ejs +0 -0
  38. package/layout/_partials/plugins/analytics.ejs +87 -0
  39. package/layout/_partials/plugins/anchorjs.ejs +24 -0
  40. package/layout/_partials/plugins/code-widget.ejs +71 -0
  41. package/layout/_partials/plugins/fancybox.ejs +11 -0
  42. package/layout/_partials/plugins/highlight.ejs +13 -0
  43. package/layout/_partials/plugins/math.ejs +46 -0
  44. package/layout/_partials/plugins/mermaid.ejs +5 -0
  45. package/layout/{_partial → _partials}/plugins/nprogress.ejs +0 -0
  46. package/layout/_partials/plugins/typed.ejs +48 -0
  47. package/layout/_partials/post/category-bar.ejs +18 -0
  48. package/layout/_partials/post/copyright.ejs +56 -0
  49. package/layout/_partials/post/meta-bottom.ejs +16 -0
  50. package/layout/_partials/post/meta-top.ejs +63 -0
  51. package/layout/_partials/post/sidebar-left.ejs +10 -0
  52. package/layout/_partials/post/sidebar-right.ejs +10 -0
  53. package/layout/_partials/post/toc.ejs +34 -0
  54. package/layout/_partials/scripts.ejs +32 -0
  55. package/layout/{_partial → _partials}/search.ejs +2 -3
  56. package/layout/about.ejs +5 -3
  57. package/layout/archive.ejs +1 -1
  58. package/layout/categories.ejs +10 -59
  59. package/layout/category.ejs +1 -1
  60. package/layout/index.ejs +13 -15
  61. package/layout/layout.ejs +19 -39
  62. package/layout/links.ejs +2 -8
  63. package/layout/page.ejs +28 -12
  64. package/layout/post.ejs +65 -59
  65. package/layout/tag.ejs +1 -1
  66. package/package.json +11 -3
  67. package/scripts/.DS_Store +0 -0
  68. package/scripts/events/.DS_Store +0 -0
  69. package/scripts/events/index.js +1 -0
  70. package/scripts/events/lib/compatible-configs.js +7 -8
  71. package/scripts/events/lib/footnote.js +1 -1
  72. package/scripts/events/lib/hello.js +6 -2
  73. package/scripts/events/lib/highlight.js +93 -24
  74. package/scripts/events/lib/injects.js +118 -0
  75. package/scripts/events/lib/merge-configs.js +37 -7
  76. package/scripts/filters/default-injects.js +27 -0
  77. package/scripts/filters/post-filter.js +7 -0
  78. package/scripts/helpers/date.js +25 -0
  79. package/scripts/helpers/engine.js +9 -0
  80. package/scripts/helpers/export-config.js +8 -0
  81. package/scripts/helpers/import.js +24 -0
  82. package/scripts/helpers/injects.js +7 -0
  83. package/scripts/helpers/scope.js +44 -0
  84. package/scripts/helpers/utils.js +17 -2
  85. package/scripts/tags/checkbox.js +4 -2
  86. package/scripts/utils/.DS_Store +0 -0
  87. package/scripts/utils/object.js +5 -0
  88. package/scripts/utils/resolve.js +15 -0
  89. package/source/.DS_Store +0 -0
  90. package/source/css/_pages/_archive/archive.styl +28 -0
  91. package/source/css/_pages/_base/_widget/anchorjs.styl +8 -0
  92. package/source/css/_pages/_base/_widget/banner.styl +2 -11
  93. package/source/css/_pages/_base/_widget/board.styl +1 -4
  94. package/source/css/_pages/_base/_widget/code-widget.styl +36 -0
  95. package/source/css/_pages/_base/_widget/copyright.styl +90 -0
  96. package/source/css/_pages/_base/_widget/footer.styl +4 -1
  97. package/source/css/_pages/_base/_widget/header.styl +161 -2
  98. package/source/css/_pages/_base/_widget/modal.styl +100 -0
  99. package/source/css/_pages/_base/_widget/ngrogress.styl +12 -0
  100. package/source/css/_pages/_base/_widget/noscript.styl +12 -0
  101. package/source/css/_pages/_base/_widget/pagination.styl +23 -0
  102. package/source/css/_pages/_base/_widget/scroll-btn.styl +2 -15
  103. package/source/css/_pages/_base/_widget/toc.styl +75 -0
  104. package/source/css/_pages/_base/base.styl +23 -3
  105. package/source/css/_pages/_base/color-schema.styl +30 -58
  106. package/source/css/_pages/_base/inline.styl +2 -2
  107. package/source/css/_pages/_category/category-bar.styl +59 -0
  108. package/source/css/_pages/_category/category-chain.styl +6 -0
  109. package/source/css/_pages/_category/{categories.styl → category-list.styl} +17 -11
  110. package/source/css/_pages/_index/index.styl +7 -5
  111. package/source/css/_pages/_links/links.styl +2 -1
  112. package/source/css/_pages/_post/comment.styl +27 -0
  113. package/source/css/_pages/_post/highlight.styl +65 -0
  114. package/source/css/_pages/_post/markdown.styl +91 -0
  115. package/source/css/_pages/_post/{post.styl → post-page.styl} +44 -75
  116. package/source/css/_pages/_post/{tag_plugin.styl → post-tag.styl} +29 -27
  117. package/source/css/_variables/base.styl +30 -9
  118. package/source/css/highlight-dark.styl +6 -0
  119. package/source/css/highlight.styl +6 -0
  120. package/source/css/main.styl +7 -0
  121. package/source/img/.DS_Store +0 -0
  122. package/source/img/default.png +0 -0
  123. package/source/img/{favicon.png → fluid.png} +0 -0
  124. package/source/js/boot.js +1 -9
  125. package/source/js/color-schema.js +52 -7
  126. package/source/js/events.js +15 -15
  127. package/source/js/leancloud.js +9 -2
  128. package/source/js/local-search.js +2 -2
  129. package/source/js/plugins.js +26 -94
  130. package/source/js/utils.js +28 -12
  131. package/.editorconfig +0 -13
  132. package/.eslintrc +0 -224
  133. package/.gitattributes +0 -1
  134. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -28
  135. package/.github/ISSUE_TEMPLATE/bug_report_zh.md +0 -33
  136. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
  137. package/.github/ISSUE_TEMPLATE/feature_request_zh.md +0 -20
  138. package/.github/ISSUE_TEMPLATE/question.md +0 -11
  139. package/.github/ISSUE_TEMPLATE/question_zh.md +0 -14
  140. package/.github/workflows/limit.yaml +0 -18
  141. package/README_en.md +0 -125
  142. package/layout/_partial/beian.ejs +0 -36
  143. package/layout/_partial/css.ejs +0 -47
  144. package/layout/_partial/footer.ejs +0 -11
  145. package/layout/_partial/plugins/analytics.ejs +0 -66
  146. package/layout/_partial/plugins/math.ejs +0 -69
  147. package/layout/_partial/plugins/mermaid.ejs +0 -24
  148. package/layout/_partial/plugins/typed.ejs +0 -41
  149. package/layout/_partial/post-meta.ejs +0 -51
  150. package/layout/_partial/scripts.ejs +0 -72
  151. package/layout/_partial/statistics.ejs +0 -43
  152. package/layout/_partial/toc.ejs +0 -4
  153. package/source/css/_pages/_base/_widget/copy-btn.styl +0 -42
  154. package/source/css/_pages/_base/rewrite.styl +0 -556
  155. package/source/css/_pages/_category/category.styl +0 -0
@@ -0,0 +1,46 @@
1
+ <% if(theme.post.math.engine === 'mathjax') { %>
2
+ <%
3
+ var lazy = theme.lazyload.enable && require_version(theme.static_prefix.mathjax, '3.2.0')
4
+
5
+ import_script(`
6
+ <script>
7
+ MathJax = {
8
+ tex : {
9
+ inlineMath: { '[+]': [['$', '$']] }
10
+ },
11
+ loader : {
12
+ ${ lazy ? 'load: \[\'ui/lazy\'\]' : '' }
13
+ },
14
+ options: {
15
+ renderActions: {
16
+ findScript : [10, doc => {
17
+ document.querySelectorAll('script[type^="math/tex"]').forEach(node => {
18
+ const display = !!node.type.match(/; *mode=display/);
19
+ const math = new doc.options.MathItem(node.textContent, doc.inputJax[0], display);
20
+ const text = document.createTextNode('');
21
+ node.parentNode.replaceChild(text, node);
22
+ math.start = { node: text, delim: '', n: 0 };
23
+ math.end = { node: text, delim: '', n: 0 };
24
+ doc.math.push(math);
25
+ });
26
+ }, '', false],
27
+ insertedScript: [200, () => {
28
+ document.querySelectorAll('mjx-container').forEach(node => {
29
+ let target = node.parentNode;
30
+ if (target.nodeName.toLowerCase() === 'li') {
31
+ target.parentNode.classList.add('has-jax');
32
+ }
33
+ });
34
+ }, '', false]
35
+ }
36
+ }
37
+ };
38
+ </script>
39
+ `)
40
+
41
+ import_js(theme.static_prefix.mathjax.replace('es5/', ''), 'es5/tex-mml-chtml.js')
42
+ %>
43
+
44
+ <% } else if (theme.post.math.engine === 'katex') { %>
45
+ <% import_css(theme.static_prefix.katex, 'katex.min.css') %>
46
+ <% } %>
@@ -0,0 +1,5 @@
1
+ <script>
2
+ Fluid.utils.createScript('<%= url_join(theme.static_prefix.mermaid, 'mermaid.min.js') %>', function() {
3
+ mermaid.initialize(<%- JSON.stringify(theme.post.mermaid.options || {}) %>);
4
+ });
5
+ </script>
@@ -0,0 +1,48 @@
1
+ <% if(theme.fun_features.typing.enable && in_scope(theme.fun_features.typing.scope) && page.subtitle !== false) { %>
2
+ <%- js_ex(theme.static_prefix.typed, '/typed.min.js') %>
3
+ <script>
4
+ (function (window, document) {
5
+ var typing = Fluid.plugins.typing;
6
+ var subtitle = document.getElementById('subtitle');
7
+ if (!subtitle || !typing) {
8
+ return;
9
+ }
10
+ var text = subtitle.getAttribute('data-typed-text');
11
+ <% if (is_home() && theme.index.slogan.api && theme.index.slogan.api.enable) { %>
12
+ jQuery.ajax({
13
+ type: '<%= theme.index.slogan.api.method %>',
14
+ url: '<%= theme.index.slogan.api.url %>',
15
+ headers: <%- JSON.stringify(theme.index.slogan.api.headers || {}) %>,
16
+ dataType: 'json',
17
+ success: function(result) {
18
+ var apiText;
19
+ if (result) {
20
+ var keys = '<%= theme.index.slogan.api.keys %>'.split(',');
21
+ if (result instanceof Array) {
22
+ result = result[0];
23
+ }
24
+ for (const k of keys) {
25
+ var value = result[k];
26
+ if (typeof value === 'string') {
27
+ apiText = value;
28
+ break;
29
+ } else if (value instanceof Object) {
30
+ result = value;
31
+ }
32
+ }
33
+ }
34
+ apiText ? typing(apiText) : typing(text);
35
+ },
36
+ error: function(xhr, status, error) {
37
+ if (error) {
38
+ console.error('Failed to request <%= theme.index.slogan.api.url %>:', error);
39
+ }
40
+ typing(text);
41
+ }
42
+ })
43
+ <% } else { %>
44
+ typing(text);
45
+ <% } %>
46
+ })(window, document);
47
+ </script>
48
+ <% } %>
@@ -0,0 +1,18 @@
1
+ <%
2
+ var parent = page.categories
3
+ if (Array.isArray(page.category_bar)) {
4
+ parent = parent.filter(cat => page.category_bar.indexOf(cat.name) !== -1)
5
+ }
6
+ var activeIds = page.categories.map(c => c._id)
7
+ activeIds.push(page._id)
8
+ %>
9
+
10
+ <%- partial('_partials/category-list', {
11
+ curCats : parent,
12
+ params: {
13
+ type : 'post',
14
+ activeIds: activeIds,
15
+ postLimit: theme.post.category_bar.post_limit,
16
+ postOrderBy: theme.post.category_bar.post_order_by || config.index_generator.order_by
17
+ }
18
+ }) %>
@@ -0,0 +1,56 @@
1
+ <% if (theme.post.copyright.enable && page.copyright !== false) { %>
2
+ <%
3
+ var license = theme.post.copyright.license
4
+ if (typeof page.copyright === 'string') {
5
+ license = page.copyright
6
+ } else if (typeof page.license === 'string') {
7
+ license = page.license
8
+ }
9
+ license = license.toUpperCase()
10
+ %>
11
+
12
+ <div class="license-box my-3">
13
+ <div class="license-title">
14
+ <div><%= page.title %></div>
15
+ <div><%= decode_url(page.permalink) %></div>
16
+ </div>
17
+ <div class="license-meta">
18
+ <% if (theme.post.copyright.author.enable && (page.author || config.author)) { %>
19
+ <div class="license-meta-item">
20
+ <div><%- __('post.copyright.author') %></div>
21
+ <div><%- page.author || config.author %></div>
22
+ </div>
23
+ <% } %>
24
+ <% if (theme.post.copyright.post_date.enable && page.date) { %>
25
+ <div class="license-meta-item license-meta-date">
26
+ <div><%- __('post.copyright.posted') %></div>
27
+ <div><%= full_date(page.date, theme.post.copyright.post_date.format || 'LL') %></div>
28
+ </div>
29
+ <% } %>
30
+ <% if (theme.post.copyright.update_date.enable && page.updated && compare_date(page.date, page.updated)) { %>
31
+ <div class="license-meta-item license-meta-date">
32
+ <div><%- __('post.copyright.updated') %></div>
33
+ <div><%= full_date(page.updated, theme.post.copyright.update_date.format || 'LL') %></div>
34
+ </div>
35
+ <% } %>
36
+ <div class="license-meta-item">
37
+ <div><%- __('post.copyright.licensed') %></div>
38
+ <div>
39
+ <% if (['BY', 'BY-SA', 'BY-ND', 'BY-NC', 'BY-NC-SA', 'BY-NC-ND'].indexOf(license) !== -1) { %>
40
+ <% var items = license.split('-') %>
41
+ <% for (var idx = 0; idx < items.length; idx++) { %>
42
+ <a target="_blank" href="https://creativecommons.org/licenses/<%= license.toLowerCase() %>/4.0/">
43
+ <span class="hint--top hint--rounded" aria-label="<%- __('post.copyright.' + items[idx]) %>">
44
+ <i class="iconfont icon-<%= items[idx].toLowerCase() %>"></i>
45
+ </span>
46
+ </a>
47
+ <% } %>
48
+ <% } else { %>
49
+ <%- license %>
50
+ <% } %>
51
+ </div>
52
+ </div>
53
+ </div>
54
+ <div class="license-icon iconfont"></div>
55
+ </div>
56
+ <% } %>
@@ -0,0 +1,16 @@
1
+ <div class="post-metas my-3">
2
+ <% if (page.categories && page.categories.length > 0) { %>
3
+ <div class="post-meta mr-3 d-flex align-items-center">
4
+ <i class="iconfont icon-category"></i>
5
+ <%- partial('_partials/category-chains', { categories: page.categories }) %>
6
+ </div>
7
+ <% } %>
8
+ <% if (page.tags && page.tags.length > 0 ) { %>
9
+ <div class="post-meta">
10
+ <i class="iconfont icon-tags"></i>
11
+ <% page.tags.each(function(tag) { %>
12
+ <a href="<%= url_for(tag.path) %>">#<%- tag.name %></a>
13
+ <% }) %>
14
+ </div>
15
+ <% } %>
16
+ </div>
@@ -0,0 +1,63 @@
1
+ <% if (page.meta !== false) { %>
2
+ <div class="mt-3">
3
+ <% if (theme.post.meta.author && theme.post.meta.author.enable && (page.author || config.author)) { %>
4
+ <span class="post-meta mr-2">
5
+ <i class="iconfont icon-author" aria-hidden="true"></i>
6
+ <%- page.author || config.author %>
7
+ </span>
8
+ <% } %>
9
+ <% if (theme.post.meta.date.enable) { %>
10
+ <span class="post-meta">
11
+ <i class="iconfont icon-date-fill" aria-hidden="true"></i>
12
+ <time datetime="<%= full_date(page.date, 'YYYY-MM-DD HH:mm') %>" pubdate>
13
+ <%= full_date(page.date, theme.post.meta.date.format) %>
14
+ </time>
15
+ </span>
16
+ <% } %>
17
+ </div>
18
+
19
+ <div class="mt-1">
20
+ <% if (theme.post.meta.wordcount.enable) { %>
21
+ <span class="post-meta mr-2">
22
+ <i class="iconfont icon-chart"></i>
23
+ <% if (theme.post.meta.wordcount.format) { %>
24
+ <!-- compatible with older versions-->
25
+ <%- theme.post.meta.wordcount.format.replace('{}', wordcount(page)) %>
26
+ <% } else { %>
27
+ <%- __('post.meta.wordcount', wordcount(page)) %>
28
+ <% } %>
29
+ </span>
30
+ <% } %>
31
+
32
+ <% if (theme.post.meta.min2read.enable) { %>
33
+ <span class="post-meta mr-2">
34
+ <i class="iconfont icon-clock-fill"></i>
35
+ <% var awl = parseInt(theme.post.meta.min2read.awl, 10) %>
36
+ <% var wpm = parseInt(theme.post.meta.min2read.wpm, 10) %>
37
+ <% if (theme.post.meta.min2read.format) { %>
38
+ <!-- compatible with older versions-->
39
+ <%- theme.post.meta.min2read.format.replace('{}', min2read(page, { awl: awl, wpm: wpm })) %>
40
+ <% } else { %>
41
+ <%- __('post.meta.min2read', min2read(page, { awl: awl, wpm: wpm })) %>
42
+ <% } %>
43
+ </span>
44
+ <% } %>
45
+
46
+ <% var views_texts = (theme.post.meta.views.format || __('post.meta.views')).split('{}') %>
47
+ <% if (theme.post.meta.views.enable && views_texts.length >= 2) { %>
48
+ <% if (theme.post.meta.views.source === 'leancloud') { %>
49
+ <span id="leancloud-page-views-container" class="post-meta" style="display: none">
50
+ <i class="iconfont icon-eye" aria-hidden="true"></i>
51
+ <%- views_texts[0] %><span id="leancloud-page-views"></span><%- views_texts[1] %>
52
+ </span>
53
+ <% import_js(theme.static_prefix.internal_js, 'leancloud.js', 'defer') %>
54
+ <% } else if (theme.post.meta.views.source === 'busuanzi') { %>
55
+ <span id="busuanzi_container_page_pv" style="display: none">
56
+ <i class="iconfont icon-eye" aria-hidden="true"></i>
57
+ <%- views_texts[0] %><span id="busuanzi_value_page_pv"></span><%- views_texts[1] %>
58
+ </span>
59
+ <% import_js(theme.static_prefix.busuanzi, 'busuanzi.pure.mini.js', 'defer') %>
60
+ <% } %>
61
+ <% } %>
62
+ </div>
63
+ <% } %>
@@ -0,0 +1,10 @@
1
+ <% if(theme.post.toc.enable && theme.post.toc.placement === 'left' && page.toc !== false){ %>
2
+ <aside class="sidebar" style="padding-left: 2rem; margin-right: -1rem">
3
+ <%- partial('_partials/post/toc') %>
4
+ </aside>
5
+ <% } else if (theme.post.category_bar.enable && theme.post.category_bar.placement !== 'right' && !page.hide &&
6
+ (!theme.post.category_bar.specific || (theme.post.category_bar.specific && page.category_bar))) { %>
7
+ <aside class="sidebar category-bar" style="margin-right: -1rem">
8
+ <%- partial('_partials/post/category-bar') %>
9
+ </aside>
10
+ <% } %>
@@ -0,0 +1,10 @@
1
+ <% if(theme.post.toc.enable && theme.post.toc.placement !== 'left' && page.toc !== false){ %>
2
+ <aside class="sidebar" style="margin-left: -1rem">
3
+ <%- partial('_partials/post/toc') %>
4
+ </aside>
5
+ <% } else if (theme.post.category_bar.enable && theme.post.category_bar.placement === 'right' && !page.hide &&
6
+ (!theme.post.category_bar.specific || (theme.post.category_bar.specific && page.category_bar))) { %>
7
+ <aside class="sidebar category-bar" style="margin-left: -1rem">
8
+ <%- partial('_partials/post/category-bar') %>
9
+ </aside>
10
+ <% } %>
@@ -0,0 +1,34 @@
1
+ <div id="toc">
2
+ <p class="toc-header"><i class="iconfont icon-list"></i>&nbsp;<%- __('post.toc') %></p>
3
+ <div class="toc-body" id="toc-body"></div>
4
+ </div>
5
+
6
+ <%
7
+ import_script(`
8
+ <script>
9
+ Fluid.utils.createScript('${url_join(theme.static_prefix.tocbot, 'tocbot.min.js')}', function() {
10
+ var toc = jQuery('#toc');
11
+ if (toc.length === 0 || !window.tocbot) { return; }
12
+ var boardCtn = jQuery('#board-ctn');
13
+ var boardTop = boardCtn.offset().top;
14
+
15
+ window.tocbot.init({
16
+ tocSelector : '#toc-body',
17
+ contentSelector : '.markdown-body',
18
+ headingSelector : CONFIG.toc.headingSelector || 'h1,h2,h3,h4,h5,h6',
19
+ linkClass : 'tocbot-link',
20
+ activeLinkClass : 'tocbot-active-link',
21
+ listClass : 'tocbot-list',
22
+ isCollapsedClass: 'tocbot-is-collapsed',
23
+ collapsibleClass: 'tocbot-is-collapsible',
24
+ collapseDepth : CONFIG.toc.collapseDepth || 0,
25
+ scrollSmooth : true,
26
+ headingsOffset : -boardTop
27
+ });
28
+ if (toc.find('.toc-list-item').length > 0) {
29
+ toc.css('visibility', 'visible');
30
+ }
31
+ });
32
+ </script>
33
+ `)
34
+ %>
@@ -0,0 +1,32 @@
1
+ <%- partial('_partials/plugins/nprogress.ejs') %>
2
+ <%- js_ex(theme.static_prefix.jquery, 'jquery.min.js') %>
3
+ <%- js_ex(theme.static_prefix.bootstrap, 'js/bootstrap.min.js') %>
4
+ <%- js_ex(theme.static_prefix.internal_js, 'events.js') %>
5
+ <%- js_ex(theme.static_prefix.internal_js, 'plugins.js') %>
6
+
7
+ <%- partial('_partials/plugins/typed.ejs') %>
8
+ <%- partial('_partials/plugins/analytics.ejs') %>
9
+
10
+ <% if (theme.lazyload.enable){ %>
11
+ <% if (theme.lazyload.onlypost) { %>
12
+ <% if (is_post() || is_page()) { %>
13
+ <%- js_ex(theme.static_prefix.internal_js, 'img-lazyload.js') %>
14
+ <% } %>
15
+ <% } else { %>
16
+ <%- js_ex(theme.static_prefix.internal_js, 'img-lazyload.js') %>
17
+ <% } %>
18
+ <% } %>
19
+
20
+ <% var script_snippets = deduplicate(page.script_snippets) %>
21
+ <% for (var idx = 0; idx < script_snippets.length; idx++) { %>
22
+ <%- script_snippets[idx] %>
23
+ <% } %>
24
+ <% page.script_snippets = [] %>
25
+
26
+ <% if (theme.custom_js) { %>
27
+ <%- js(theme.custom_js) %>
28
+ <% } %>
29
+
30
+ <!-- 主题的启动项,将它保持在最底部 -->
31
+ <!-- the boot of the theme, keep it at the bottom -->
32
+ <%- js_ex(theme.static_prefix.internal_js, 'boot.js') %>
@@ -11,11 +11,10 @@
11
11
  <div class="modal-body mx-3">
12
12
  <div class="md-form mb-5">
13
13
  <input type="text" id="local-search-input" class="form-control validate">
14
- <label data-error="<%= __('search.status.error') %>" data-success="<%= __('search.status.success') %>"
15
- for="local-search-input"><%= __('search.keyword') %></label>
14
+ <label data-error="x" data-success="v" for="local-search-input"><%= __('search.keyword') %></label>
16
15
  </div>
17
16
  <div class="list-group" id="local-search-result"></div>
18
17
  </div>
19
18
  </div>
20
19
  </div>
21
- </div>
20
+ </div>
package/layout/about.ejs CHANGED
@@ -38,14 +38,16 @@ page.banner_mask_alpha = page.banner_mask_alpha || theme.about.banner_mask_alpha
38
38
 
39
39
  <% if(page.comments) { %>
40
40
  <!-- Comments -->
41
- <article class="comments" id="comments">
41
+ <article id="comments">
42
42
  <% var type %>
43
43
  <% if (typeof page.comment === 'string' && page.comment !== '') { %>
44
- <% type = '_partial/comments/' + page.comment %>
44
+ <% type = '_partials/comments/' + page.comment %>
45
45
  <% } else { %>
46
- <% type = '_partial/comments/' + theme.post.comments.type %>
46
+ <% type = '_partials/comments/' + theme.post.comments.type %>
47
47
  <% } %>
48
48
  <%- partial(type) %>
49
49
  </article>
50
50
  <% } %>
51
51
  </article>
52
+
53
+ <% import_css(theme.static_prefix.hint, 'hint.min.css') %>
@@ -7,4 +7,4 @@ page.banner_img_height = theme.archive.banner_img_height
7
7
  page.banner_mask_alpha = theme.archive.banner_mask_alpha
8
8
  %>
9
9
 
10
- <%- partial('_partial/archive-list.ejs', { params: { postTotal: site.posts.length } }) %>
10
+ <%- partial('_partials/archive-list.ejs', { params: { key: page.layout, postTotal: site.posts.length } }) %>
@@ -1,68 +1,19 @@
1
1
  <%
2
- page.layout = "categories"
2
+ page.layout = 'categories'
3
3
  page.title = theme.category.title || __('category.title')
4
4
  page.subtitle = theme.category.subtitle || __('category.subtitle')
5
5
  page.banner_img = theme.category.banner_img
6
6
  page.banner_img_height = theme.category.banner_img_height
7
7
  page.banner_mask_alpha = theme.category.banner_mask_alpha
8
-
9
8
  var orderBy = theme.category.order_by || 'name'
9
+ var curCats = site.categories.find({ parent: { $exists: false } }).sort(orderBy).filter(cat => cat.length)
10
10
  %>
11
11
 
12
- <% function render_categories(cats, depth) { %>
13
- <% depth = depth || 0 %>
14
- <% return cats.each((cat) => { %>
15
- <% var subCats = site.categories.find({parent: cat._id}).sort(orderBy).filter(cat => cat.length) %>
16
- <% var collapsed = subCats.length === 0 || depth >= theme.category.collapse_depth %>
17
- <div class="<%= depth <= 0 ? 'category' : 'category-sub' %> row">
18
- <a
19
- class="<%= depth <= 0 ? 'category-item' : 'category-subitem' %> <%= collapsed ? 'collapsed' : '' %> list-group-item category-item-action col-10 col-md-11"
20
- id="heading-<%= md5(cat.name) %>" role="tab" data-toggle="collapse" href="#collapse-<%= md5(cat.name) %>"
21
- aria-expanded="<%= collapsed ? 'false' : 'true' %>"
22
- >
23
- <%= cat.name %>
24
- <i class="iconfont icon-arrowright"></i>
25
- </a>
26
- <a href="<%= url_for(cat.path) %>" class="category-count col-2 col-md-1">
27
- <i class="iconfont icon-articles"></i>
28
- <span><%= cat.posts.length %></span>
29
- </a>
30
- <div class="category-collapse collapse" id="collapse-<%= md5(cat.name) %>" role="tabpanel" aria-labelledby="heading-<%= md5(cat.name) %>">
31
- <% var posts = cat.posts.sort(theme.category.post_order_by || config.index_generator.order_by || '-date') %>
32
- <% if (subCats.length > 0) { %>
33
- <% var filteredPosts = posts.filter((p) => {
34
- return p.categories.filter(catOnPost => catOnPost.parent === cat._id).length === 0;
35
- }) %>
36
- <%- render_posts(filteredPosts, cat) %>
37
- <%- render_categories(subCats, depth + 1) %>
38
- <% } else { %>
39
- <%- render_posts(posts, cat) %>
40
- <% } %>
41
- </div>
42
- </div>
43
- <% }) %>
44
- <% } %>
45
-
46
- <% function render_posts(posts, cat) { %>
47
- <div class="category-post-list">
48
- <% var limit = theme.category.post_limit %>
49
- <% for (var idx = 0; idx < posts.length; idx++) { %>
50
- <% var post = posts.data[idx] %>
51
- <% if (idx && limit && idx >= limit) { %>
52
- <a href="<%= url_for(cat.path) %>" class="list-group-item list-group-item-action">
53
- <span class="category-post">More...</span>
54
- </a>
55
- <% break %>
56
- <% } else { %>
57
- <a href="<%= url_for(post.path) %>" class="list-group-item list-group-item-action">
58
- <span class="category-post"><%= post.title %></span>
59
- </a>
60
- <% } %>
61
- <% } %>
62
- </div>
63
- <% } %>
64
-
65
- <div class="category-list">
66
- <% cats = site.categories.find({parent: {$exists: false}}).sort(orderBy).filter(cat => cat.length) %>
67
- <%- render_categories(cats) %>
68
- </div>
12
+ <%- partial('_partials/category-list', {
13
+ curCats: curCats,
14
+ params: {
15
+ orderBy: orderBy,
16
+ postLimit : theme.category.post_limit,
17
+ postOrderBy: theme.category.post_order_by || config.index_generator.order_by
18
+ }
19
+ }) %>
@@ -9,4 +9,4 @@ page.banner_mask_alpha = theme.category.banner_mask_alpha
9
9
  var cat = site.categories.find({name: page.category}).filter(cat => cat.length).data[0]
10
10
  %>
11
11
 
12
- <%- partial('_partial/archive-list.ejs', { params: { postTotal: cat ? cat.posts.length : 0 } }) %>
12
+ <%- partial('_partials/archive-list.ejs', { params: { key: page.layout, postTotal: cat ? cat.posts.length : 0 } }) %>
package/layout/index.ejs CHANGED
@@ -10,7 +10,7 @@ page.banner_mask_alpha = theme.index.banner_mask_alpha
10
10
  <% page.posts.each(function (post) { %>
11
11
  <div class="row mx-auto index-card">
12
12
  <% var post_url = url_for(post.path), index_img = post.index_img || theme.post.default_index_img %>
13
- <% if(index_img) { %>
13
+ <% if (index_img) { %>
14
14
  <div class="col-12 col-md-4 m-auto index-img">
15
15
  <a href="<%= post_url %>" target="<%- theme.index.post_url_target %>">
16
16
  <img src="<%= url_for(index_img) %>" alt="<%= post.title %>">
@@ -27,15 +27,15 @@ page.banner_mask_alpha = theme.index.banner_mask_alpha
27
27
  </a>
28
28
  </h1>
29
29
 
30
- <p class="index-excerpt">
31
- <a href="<%= post_url %>" target="<%- theme.index.post_url_target %>">
32
- <% var excerpt = post.description || post.excerpt || (theme.index.auto_excerpt.enable && post.content) %>
30
+ <% var excerpt = post.description || post.excerpt || (theme.index.auto_excerpt.enable && post.content) %>
31
+ <a class="index-excerpt <%= index_img ? '' : 'index-excerpt__noimg' %>" href="<%= post_url %>" target="<%- theme.index.post_url_target %>">
32
+ <div>
33
33
  <%- escape_html(strip_html(excerpt).substring(0, 200).trim()).replace(/\n/g, ' ') %>
34
- </a>
35
- </p>
34
+ </div>
35
+ </a>
36
36
 
37
37
  <div class="index-btm post-metas">
38
- <% if(theme.index.post_meta.date ) { %>
38
+ <% if (theme.index.post_meta.date) { %>
39
39
  <div class="post-meta mr-3">
40
40
  <i class="iconfont icon-date"></i>
41
41
  <time datetime="<%= full_date(post.date, 'YYYY-MM-DD HH:mm') %>" pubdate>
@@ -43,19 +43,17 @@ page.banner_mask_alpha = theme.index.banner_mask_alpha
43
43
  </time>
44
44
  </div>
45
45
  <% } %>
46
- <% if(theme.index.post_meta.category && post.categories.length > 0) { %>
47
- <div class="post-meta mr-3">
46
+ <% if (theme.index.post_meta.category && post.categories.length > 0) { %>
47
+ <div class="post-meta mr-3 d-flex align-items-center">
48
48
  <i class="iconfont icon-category"></i>
49
- <% post.categories.each(function(cate){ %>
50
- <a href="<%= url_for(cate.path) %>"><%- cate.name %></a>
51
- <% }) %>
49
+ <%- partial('_partials/category-chains', { categories: post.categories, limit: 1 }) %>
52
50
  </div>
53
51
  <% } %>
54
- <% if(theme.index.post_meta.tag && post.tags.length > 0) { %>
52
+ <% if (theme.index.post_meta.tag && post.tags.length > 0) { %>
55
53
  <div class="post-meta">
56
54
  <i class="iconfont icon-tags"></i>
57
55
  <% post.tags.each(function(tag){ %>
58
- <a href="<%= url_for(tag.path) %>"><%- tag.name %></a>
56
+ <a href="<%= url_for(tag.path) %>">#<%- tag.name %></a>
59
57
  <% }) %>
60
58
  </div>
61
59
  <% } %>
@@ -64,4 +62,4 @@ page.banner_mask_alpha = theme.index.banner_mask_alpha
64
62
  </div>
65
63
  <% }) %>
66
64
 
67
- <%- partial('_partial/paginator') %>
65
+ <%- partial('_partials/paginator') %>
package/layout/layout.ejs CHANGED
@@ -1,44 +1,18 @@
1
1
  <%
2
- var subtitle = page.subtitle || page.title
3
- var banner_img = page.banner_img || theme.index.banner_img
4
- var banner_img_height = page.banner_img_height || theme.index.banner_img_height
5
- var banner_mask_alpha = page.banner_mask_alpha || theme.index.banner_mask_alpha
2
+ var banner_img_height = parseFloat(page.banner_img_height || theme.index.banner_img_height)
6
3
  var colorSchema = theme.dark_mode && theme.dark_mode.enable && theme.dark_mode.default ? theme.dark_mode.default : ''
7
4
  %>
8
5
 
9
6
  <!DOCTYPE html>
10
7
  <html lang="<%= config.language %>" <%= colorSchema ? `data-default-color-scheme=${colorSchema}` : '' %>>
11
8
 
12
- <%- partial('_partial/head') %>
9
+ <%- partial('_partials/head.ejs') %>
13
10
 
14
11
  <body>
15
- <header style="height: <%- banner_img_height %>vh;">
16
- <%- partial('_partial/nav') %>
17
- <div class="banner" id="banner" <%- theme.banner && theme.banner.parallax && 'parallax=true' %>
18
- style="background: url('<%- url_for(banner_img) %>') no-repeat center center;
19
- background-size: cover;">
20
- <div class="full-bg-img">
21
- <div class="mask flex-center" style="background-color: rgba(0, 0, 0, <%= parseFloat(banner_mask_alpha) %>)">
22
- <div class="page-header text-center fade-in-up">
23
- <span class="h2" id="subtitle" title="<%= subtitle %>">
24
- <% if(!theme.fun_features.typing.enable) { %>
25
- <%- subtitle %>
26
- <% } %>
27
- </span>
12
+ <%- inject_point('bodyBegin') %>
28
13
 
29
- <% if(is_post() && page.meta !== false) { %>
30
- <%- partial('_partial/post-meta') %>
31
- <% } %>
32
- </div>
33
-
34
- <% if (theme.scroll_down_arrow.enable && theme.scroll_down_arrow.banner_height_limit <= banner_img_height && page.layout !== '404') { %>
35
- <div class="scroll-down-bar">
36
- <i class="iconfont icon-arrowdown"></i>
37
- </div>
38
- <% } %>
39
- </div>
40
- </div>
41
- </div>
14
+ <header>
15
+ <%- inject_point('header') %>
42
16
  </header>
43
17
 
44
18
  <main>
@@ -46,12 +20,11 @@ var colorSchema = theme.dark_mode && theme.dark_mode.enable && theme.dark_mode.d
46
20
  <%- body %>
47
21
  <% } else { %>
48
22
  <div class="container nopadding-x-md">
49
- <div class="py-5" id="board"
50
- <%- banner_img_height >= 100 && theme.banner && theme.banner.parallax ? 'style=margin-top:0' : '' %>>
23
+ <div id="board"
24
+ <%- banner_img_height >= 100 && theme.banner && theme.banner.parallax ? 'style="margin-top: 0"' : '' %>>
51
25
  <% if(page.layout === 'about') { %>
52
26
  <div class="about-avatar">
53
- <img src="<%= url_for(theme.about.avatar) %>"
54
- class="img-fluid" alt="avatar">
27
+ <img src="<%= url_for(theme.about.avatar) %>" class="img-fluid" alt="avatar">
55
28
  </div>
56
29
  <% } %>
57
30
  <div class="container">
@@ -72,7 +45,7 @@ var colorSchema = theme.dark_mode && theme.dark_mode.enable && theme.dark_mode.d
72
45
  <% } %>
73
46
 
74
47
  <% if (theme.search.enable) { %>
75
- <%- partial('_partial/search') %>
48
+ <%- partial('_partials/search.ejs') %>
76
49
  <% } %>
77
50
 
78
51
  <% if (theme.custom_html) { %>
@@ -84,10 +57,17 @@ var colorSchema = theme.dark_mode && theme.dark_mode.enable && theme.dark_mode.d
84
57
  <% } %>
85
58
  </main>
86
59
 
87
- <%- partial('_partial/footer', { params: { subtitle: subtitle } }) %>
60
+ <footer>
61
+ <%- inject_point('footer') %>
62
+ </footer>
63
+
64
+ <!-- Scripts -->
65
+ <%- partial('_partials/scripts.ejs') %>
88
66
 
89
- <!-- SCRIPTS -->
90
- <%- partial('_partial/scripts') %>
67
+ <%- inject_point('bodyEnd') %>
91
68
 
69
+ <noscript>
70
+ <div class="noscript-warning"><%- __('noscript_warning') %></div>
71
+ </noscript>
92
72
  </body>
93
73
  </html>