我可以使用 Liquid 模板在 Jekyll 中有一个合适的漂亮的平铺分页吗? [英] Can I have a proper nice tiled pagination in Jekyll using Liquid templates?

查看:17
本文介绍了我可以使用 Liquid 模板在 Jekyll 中有一个合适的漂亮的平铺分页吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现了这个不错的 jekyll 主题:.

我基于您使用的逻辑(最小/最大),但它也内置了更多数学.它可以使用 CSS 进行自定义,因此它应该能够执行您所描述的操作.我希望它可以满足您的需求!如果没有,请在 GitHub 上提交问题.

I've found this nice jekyll theme: http://www.jacoporabolini.com/emerald/ with good looking pagination. Unfortunately is only good looking when there is a small number of pages. In case of my blog this looks like this:

Not surprisingly because the code looks like this:

{% for page in (1..paginator.total_pages) %}

And it should like more like this:

 {% for page in (min(1,paginator.page-3)..max(paginator.page+3,paginator.total_pages)) %} 

The problem is, I don't think there is something like min and max in Liquid or even arithmetic operators like + or -. I was searching though the documentation and couldn't find min or max. I've also checked many themes and all they offer is this naive pagination, no pagination at all and first|current|next type of pagination. Any hints are appreciated.

解决方案

I wrote a Liquid {% include %} that does what you are looking for. Jekyll Paginator Links.

I based it on the logic you used (min/max), but it has a bit more math built in as well. It's customizable with CSS so it should be able to do what you have described. I hope it does what you need it to! If not, submit an issue on GitHub.

这篇关于我可以使用 Liquid 模板在 Jekyll 中有一个合适的漂亮的平铺分页吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆