diff --git a/demo/_config.async.yml b/demo/_config.async.yml index e30c2d1e..13cdd314 100644 --- a/demo/_config.async.yml +++ b/demo/_config.async.yml @@ -103,6 +103,7 @@ theme: layout: footer: async/footer - page_loading: async/page_loading + page_loading: async/page-loading + post_card: async/post-card fixed_btn: async/fixed-btn header_search: async/empty \ No newline at end of file diff --git a/demo/layout/footer.pug b/demo/layout/footer.pug index d2cfc9fd..7bc9ef64 100644 --- a/demo/layout/footer.pug +++ b/demo/layout/footer.pug @@ -1,11 +1 @@ -if is_home() - div - h5(class='trm-title-with-divider') 自定义 Footer 模板 - span(data-number='02') - div(class='trm-card') - p 使用 pug 渲染 - p(class='trm-mt-10') 仅在首页显示 - include ./test.pug - p(class='trm-mt-10') 插入主题内置 Footer 模块 - != partial('_partial/footer') diff --git a/demo/layout/page_loading.html b/demo/layout/page-loading.html similarity index 100% rename from demo/layout/page_loading.html rename to demo/layout/page-loading.html diff --git a/demo/layout/post-card.pug b/demo/layout/post-card.pug new file mode 100644 index 00000000..997e8a01 --- /dev/null +++ b/demo/layout/post-card.pug @@ -0,0 +1,39 @@ +- var coverURl = post.cover ? post.cover : (post.photos && post.photos.length ? post.photos[0] : (theme.cover.type === 'img' ? theme.cover.default : false)); +- var index = 0 || postIndex + +mixin conver + a.trm-cover-frame.trm-anima-link(href=url_for(post.path), style= { width:"40%", "padding-bottom": 0 }) + if coverURl + div !{swich_imgs(coverURl, { alt: "cover", class:"no-fancybox" })} + else + div.trm-cover-date + div.trm-cover-day !{date(post.date, theme.datetime_foramt.post_card.cover_date)} + div.trm-cover-month !{date(post.date, theme.datetime_foramt.post_card.cover_date2)} + +if postIndex === 0 && is_home() + div.col-lg-12 + include ./test.pug + h6.trm-mt-10 使用 pug 模块来自定义模板 + h6.trm-mt-10 演示主题使用自定义模块区域:首页文章卡片、主题切换、查询、Footer + +div.col-lg-12 + div.trm-blog-card.trm-scroll-animation(data-scroll, data-scroll-offset="40",style={ display: "flex" }) + if index % 2 === 0 + +conver + div.trm-card-descr(style={ padding: "40px", flex: 1 }) + div.trm-label.trm-category.trm-mb-20 + a(href= post.categories && post.categories.length ? url_for(post.categories.data[0].path) :'#.') !{post.categories && post.categories.length ? post.categories.data[0].name :__('title.unclassified')} + h5 + a.trm-anima-link(href=url_for(post.path)) !{post.title} + div.trm-divider.trm-mb-20.trm-mt-20 + ul.trm-card-data.trm-label + li !{date(post.date,theme.datetime_foramt.post_card.date)} + li !{date(post.date,theme.datetime_foramt.post_card.time)} + if theme.wordcount.enable && theme.wordcount.count + li !{wordcount(post.content)} + if theme.wordcount.enable && theme.wordcount.time + li !{min2read(post.content)} + if index % 2 !== 0 + +conver + if is_home() && post.sticky > 0 + div.trm-top !{__('post.sticky')} \ No newline at end of file diff --git a/demo/layout/test.pug b/demo/layout/test.pug index 99b3267f..5f16f2da 100644 --- a/demo/layout/test.pug +++ b/demo/layout/test.pug @@ -1 +1,2 @@ -div(class='trm-card') 使用 include 功能 \ No newline at end of file +div.trm-card + h6 使用 pug include 功能,加载了这段文字 \ No newline at end of file diff --git a/package/hexo-theme-async/layout/_partial/page/index.ejs b/package/hexo-theme-async/layout/_partial/page/index.ejs index 21239c10..5c97f823 100644 --- a/package/hexo-theme-async/layout/_partial/page/index.ejs +++ b/package/hexo-theme-async/layout/_partial/page/index.ejs @@ -33,9 +33,7 @@ <% } %> <% page.posts.each(function(post,postIndex){ %> -
- <%- partial(theme.layout.post_card,{ post }) %> -
+ <%- partial(theme.layout.post_card,{ post, postIndex}) %> <% }) %> diff --git a/package/hexo-theme-async/layout/_partial/post/post-card-mini.ejs b/package/hexo-theme-async/layout/_partial/post/post-card-mini.ejs index 2535bc1a..d266d68b 100644 --- a/package/hexo-theme-async/layout/_partial/post/post-card-mini.ejs +++ b/package/hexo-theme-async/layout/_partial/post/post-card-mini.ejs @@ -1,19 +1,21 @@ -
-
- <% let coverURl = post.cover ? - post.cover : ( post.photos && post.photos.length ? post.photos : theme.cover.default ) - %> - - - <%- swich_imgs(coverURl, { alt: "cover", class:"no-fancybox" }) %> - -
<%= post.title %>
-
-
- +
+
+
+ <% let coverURl = post.cover ? + post.cover : ( post.photos && post.photos.length ? post.photos : theme.cover.default ) + %> + + + <%- swich_imgs(coverURl, { alt: "cover", class:"no-fancybox" }) %> + +
<%= post.title %>
+
+
+
    +
  • <%= date(post.date,theme.datetime_foramt.post_card.date) %>
  • +
  • <%= date(post.date,theme.datetime_foramt.post_card.time) %>
  • +
  • <%- post.categories && post.categories.length ? post.categories.data[0].name :__('title.unclassified') %>
  • +
+
\ No newline at end of file diff --git a/package/hexo-theme-async/layout/_partial/post/post-card.ejs b/package/hexo-theme-async/layout/_partial/post/post-card.ejs index 8aca8dfa..a0803a22 100644 --- a/package/hexo-theme-async/layout/_partial/post/post-card.ejs +++ b/package/hexo-theme-async/layout/_partial/post/post-card.ejs @@ -1,44 +1,46 @@ -
- - <% let coverURl = post.cover ? - post.cover : ( - post.photos && post.photos.length ? - post.photos[0] : - ( theme.cover.type === 'img' ? theme.cover.default : false) - ) %> - <% if(coverURl) { %> - <%- swich_imgs(coverURl, { alt: "cover", class:"no-fancybox" }) %> - <% } else { %> -
-
<%= date(post.date, theme.datetime_foramt.post_card.cover_date) %>
-
<%= date(post.date, theme.datetime_foramt.post_card.cover_date2) %>
-
+
+
+ + <% let coverURl = post.cover ? + post.cover : ( + post.photos && post.photos.length ? + post.photos[0] : + ( theme.cover.type === 'img' ? theme.cover.default : false) + ) %> + <% if(coverURl) { %> + <%- swich_imgs(coverURl, { alt: "cover", class:"no-fancybox" }) %> + <% } else { %> +
+
<%= date(post.date, theme.datetime_foramt.post_card.cover_date) %>
+
<%= date(post.date, theme.datetime_foramt.post_card.cover_date2) %>
+
+ <% } %> +
+ <% if(is_home() && post.sticky > 0) { %> +
<%- __('post.sticky') %>
<% } %> - - <% if(is_home() && post.sticky > 0) { %> -
<%- __('post.sticky') %>
- <% } %> -
-
- - <%- post.categories && post.categories.length ? post.categories.data[0].name :__('title.unclassified') %> - +
+ +
+ + <%= post.title %> + +
+
+
    +
  • <%= date(post.date,theme.datetime_foramt.post_card.date) %>
  • +
  • <%= date(post.date,theme.datetime_foramt.post_card.time) %>
  • + <% if(theme.wordcount.enable && theme.wordcount.count){ %> +
  • <%= wordcount(post.content) %>
  • + <% } %> + <% if(theme.wordcount.enable && theme.wordcount.time){ %> +
  • <%= min2read(post.content) %>
  • + <% } %> +
-
- - <%= post.title %> - -
-
-
    -
  • <%= date(post.date,theme.datetime_foramt.post_card.date) %>
  • -
  • <%= date(post.date,theme.datetime_foramt.post_card.time) %>
  • - <% if(theme.wordcount.enable && theme.wordcount.count){ %> -
  • <%= wordcount(post.content) %>
  • - <% } %> - <% if(theme.wordcount.enable && theme.wordcount.time){ %> -
  • <%= min2read(post.content) %>
  • - <% } %> -
\ No newline at end of file diff --git a/package/hexo-theme-async/layout/_partial/post/post-next-prev.ejs b/package/hexo-theme-async/layout/_partial/post/post-next-prev.ejs index 50ba142a..d8ae1b31 100644 --- a/package/hexo-theme-async/layout/_partial/post/post-next-prev.ejs +++ b/package/hexo-theme-async/layout/_partial/post/post-next-prev.ejs @@ -7,13 +7,9 @@
<% if(page.prev && theme.post_pagination.enable){ %> -
- <%- theme.post_pagination.type === 'large' ? partial(theme.layout.post_card, { post: page.prev }) : partial(theme.layout.post_card_mini, { post: page.prev }) %> -
+ <%- theme.post_pagination.type === 'large' ? partial(theme.layout.post_card, { post: page.prev }) : partial(theme.layout.post_card_mini, { post: page.prev }) %> <%}%> <% if(page.next && theme.post_pagination.enable){ %> -
- <%- theme.post_pagination.type === 'large' ? partial(theme.layout.post_card, { post: page.next }) : partial(theme.layout.post_card_mini, { post: page.next }) %> -
+ <%- theme.post_pagination.type === 'large' ? partial(theme.layout.post_card, { post: page.next }) : partial(theme.layout.post_card_mini, { post: page.next }) %> <%}%>
\ No newline at end of file diff --git a/package/hexo-theme-async/source/css/_components/fixed-btn.less b/package/hexo-theme-async/source/css/_components/fixed-btn.less index f7ebf0bf..adee15f3 100644 --- a/package/hexo-theme-async/source/css/_components/fixed-btn.less +++ b/package/hexo-theme-async/source/css/_components/fixed-btn.less @@ -82,7 +82,7 @@ .transition-mixin(); - background-image : linear-gradient(var(--primary-weak-50), var(--primary-weak-50)); + background-image : var(--scroll-progress-bg-color); background-repeat : no-repeat; background-size : 100% 0; background-position: bottom; diff --git a/package/hexo-theme-async/source/css/_variables/index.less b/package/hexo-theme-async/source/css/_variables/index.less index f508c790..22e1da4c 100644 --- a/package/hexo-theme-async/source/css/_variables/index.less +++ b/package/hexo-theme-async/source/css/_variables/index.less @@ -68,6 +68,9 @@ --notice-outdate-bg : #ffe6e6; --notice-outdate-color : #ff6666; --notice-outdate-border: #ff8080; + + // scroll progress + --scroll-progress-bg-color: linear-gradient(#ffdddd, #e9ddff); } .dark() { @@ -111,6 +114,9 @@ --notice-outdate-bg : #403131; --notice-outdate-color : #ff6565; --notice-outdate-border: #bb1e1e; + + // scroll progress + --scroll-progress-bg-color: linear-gradient(#82df7a80, #82df7a80); } :root.dark {