Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请教分页相关问题 #25

Open
lizhongzhen11 opened this issue Oct 30, 2017 · 2 comments
Open

请教分页相关问题 #25

lizhongzhen11 opened this issue Oct 30, 2017 · 2 comments

Comments

@lizhongzhen11
Copy link

首先非常感谢楼主提供这个主题,很赞。
其次,我想问下关于分页的问题,目前分页只有当前页码和前进后退,但是我因为一直用所以博客多页码也多了,但是这样的话我就不能立即去特定的页码查看该页的博客了,只能不停地点击下一页慢慢找,这样不大好找,我上次在V站也看到个人用的这个主题,但是我发现他100多页每页页码都在下面,我当时忘了问他怎么实现的,我自己又不会弄这个,希望楼主能帮我一下,谢谢了~

@lizhongzhen11
Copy link
Author

我自己搞好了,需要的人可以看看

    <% page.posts.each(function(post){ %> <% var link = post.link || post.path; %>
  1. <%= post.title%>

    <% if (post.excerpt){ %> <%= strip_html(post.excerpt) %> <% } else { %> <%= strip_html(post.content).substring(0, 200)%> <% } %>…

    <%- partial('_partial/date',{post: post}) %> • 于 <%- partial('_partial/tags',{post: post}) %><%= theme.excerpt_link %>

  2. <% }) %>

<% if (page.total > 1){ %>

<% if (page.prev){ if (page.prev == 1) { page.prev_link = "/#blog"; } %> ← <%= __('previous') %> <% } %> <%= page.current %> / <%= page.total %> <% for(var count = 1; count <= page.total; count++){ %> <% if(count == 1) { %> 1 <% } else { %> <%= count%> <% } %> <% } %> <% if (page.next){ %> <%= __('next') %> → <% } %> <% } %> <%- partial('_partial/mathjax') %>
把该主题下的index.ejs代码换成我这样就好。其实就是加了个for循环。 一开始以为这是jsp,其实不是,是一个叫ejs的模板

@lizhongzhen11
Copy link
Author

??????我日,代码怎么变这样了。不影响,把上面那个for循环加上就好

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant