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){ %> -