解决top按钮生成多个问题

This commit is contained in:
结发受长生 2019-05-22 23:56:22 +08:00
parent 816c5dcd40
commit 9fe33ed376
9 changed files with 22 additions and 18 deletions

View File

@ -1,6 +1,6 @@
<% if (pagination == 2){ <% if (pagination == 2){
page.posts.each(function(post){ %> page.posts.each(function(post, postIndex){ %>
<%- partial('article', {post: post, index: true}) %> <%- partial('article', {post, param: {index: true, postIndex}}) %>
<% }) <% })
} else { } else {
var last; var last;

View File

@ -1,16 +1,19 @@
<article class="article article-type-<%= post.layout %> <%if(index){%> article-index<%}%>" itemscope itemprop="blogPost"> <% if (param.postIndex === 0 || !param.index){ %>
<%- partial('_partial/aside') %>
<% } %>
<article class="article article-type-<%= post.layout %> <%if(param.index){%> article-index<%}%>" itemscope itemprop="blogPost">
<div class="article-inner"> <div class="article-inner">
<% if (post.link || post.title){ %> <% if (post.link || post.title){ %>
<header class="article-header"> <header class="article-header">
<%- partial('post/title', {class_name: 'article-title'}) %> <%- partial('post/title', {class_name: 'article-title'}) %>
<% if (!post.noDate){ %> <% if (!post.noDate){ %>
<%- partial('post/date', {class_name: 'archive-article-date', <%- partial('post/date', {class_name: 'archive-article-date',
date_format: config.date_format+(post.excerpt && index ? '':' '+config.time_format)}) %> date_format: config.date_format+(post.excerpt && param.index ? '':' '+config.time_format)}) %>
<% } %> <% } %>
</header> </header>
<% } %> <% } %>
<div class="article-entry" itemprop="articleBody"> <div class="article-entry" itemprop="articleBody">
<% if (post.excerpt && index){ %> <% if (post.excerpt && param.index){ %>
<%- post.excerpt %> <%- post.excerpt %>
<% } else { %> <% } else { %>
<% if (!page.pageid){ %> <% if (!page.pageid){ %>
@ -29,7 +32,7 @@
<% } %> <% } %>
<%- post.content %> <%- post.content %>
<% } %> <% } %>
<% if ((theme.reward_type === 2 || (theme.reward_type === 1 && post.reward)) && !index){ %> <% if ((theme.reward_type === 2 || (theme.reward_type === 1 && post.reward)) && !param.index){ %>
<div class="page-reward"> <div class="page-reward">
<a href="javascript:;" class="page-reward-btn tooltip-top"> <a href="javascript:;" class="page-reward-btn tooltip-top">
<div class="tooltip tooltip-east"> <div class="tooltip tooltip-east">
@ -71,24 +74,23 @@
<% } %> <% } %>
<%- partial('post/tag') %> <%- partial('post/tag') %>
<%- partial('post/category') %> <%- partial('post/category') %>
<% if (index){ %> <% if (param.index){ %>
<p class="article-more-link"> <p class="article-more-link">
<a class="article-more-a" href="<%- url_for(post.path) %>"><%= __('show_full_text') %> >></a> <a class="article-more-a" href="<%- url_for(post.path) %>"><%= __('show_full_text') %> >></a>
</p> </p>
<% } %> <% } %>
<% if (!index && theme.share_jia){ %> <% if (!param.index && theme.share_jia){ %>
<%- partial('post/share') %> <%- partial('post/share') %>
<% } %> <% } %>
<div class="clearfix"></div> <div class="clearfix"></div>
</div> </div>
</div> </div>
</article> </article>
<% if (!index){ %> <% if (!param.index){ %>
<%- partial('post/nav') %> <%- partial('post/nav') %>
<% } %> <% } %>
<%- partial('_partial/aside') %>
<% if (!index && post.comments){ %> <% if (!param.index && post.comments){ %>
<% if (theme.changyan_appid && theme.changyan_conf){ %> <% if (theme.changyan_appid && theme.changyan_conf){ %>
<%- partial('post/changyan', { <%- partial('post/changyan', {
key: post.slug, key: post.slug,

View File

@ -3,7 +3,7 @@
<a class="<%= class_name %>" href="<%- url_for(post.link) %>" target="_blank" itemprop="url"><%= post.title %></a> <a class="<%= class_name %>" href="<%- url_for(post.link) %>" target="_blank" itemprop="url"><%= post.title %></a>
</h1> </h1>
<% } else if (post.title){ %> <% } else if (post.title){ %>
<% if (index){ %> <% if (param.index){ %>
<h1 itemprop="name"> <h1 itemprop="name">
<a class="<%= class_name %>" href="<%- url_for(post.path) %>"><%= post.title %></a> <a class="<%= class_name %>" href="<%- url_for(post.path) %>"><%= post.title %></a>
</h1> </h1>

View File

@ -1 +1 @@
<%- partial('_partial/archive', {pagination: config.archive, index: true}) %> <%- partial('_partial/archive', {pagination: config.archive, param:{index: true}}) %>

View File

@ -1 +1 @@
<%- partial('_partial/archive', {pagination: config.category, index: true}) %> <%- partial('_partial/archive', {pagination: config.category, param:{index: true}}) %>

View File

@ -1 +1 @@
<%- partial('_partial/article', {post: page, index: false}) %> <%- partial('_partial/article', {post: page, param:{index: false}}) %>

View File

@ -1 +1 @@
<%- partial('_partial/article', {post: page, index: false}) %> <%- partial('_partial/article', {post: page, param:{index: false}}) %>

View File

@ -1 +1 @@
<%- partial('_partial/archive', {pagination: config.tag, index: true}) %> <%- partial('_partial/archive', {pagination: config.tag, param:{index: true}}) %>

View File

@ -18,7 +18,9 @@ function init() {
// 避免由于动画带来的fix元素定位失效, 移到动画元素外层 // 避免由于动画带来的fix元素定位失效, 移到动画元素外层
var sideOpt = document.querySelector('.wrap-side-operation') var sideOpt = document.querySelector('.wrap-side-operation')
document.getElementById('container').appendChild(sideOpt) if(sideOpt) {
document.getElementById('container').appendChild(sideOpt)
}
} }
export default { init } export default { init }