上一次在修改了分类目录的样式之后,犯了一个巨大的错误,导致分类目录里会显示所有文章。
按计划,我需要在分类目录里根据发布时间对相关文章进行排序,同时还要能够显示status:secret
的文章。结果脑子一热,忘记了在get_data
函数中增加「仅在分类文件夹中搜索」的条件。
查询Farbox官方网站,得到以下说明:
cateogry
当URL路径为/any_thing/的时候,会去尝试获得一个对应的folder。注意,此时的必须要以/结尾 等价于get_doc(path=get_request_path(offset=1))
遂根据此说法修改分类目录模板如下,问题迎刃而解。
body
block content
div#posts
ul.list-with-title
entries = get_data(type='post', path=get_request_path(offset=1), status=['public', 'secret'], limit=20).group('-date:year')
for year, posts in entries
div.listing-title= year
ul.listing
for post in posts
.listing-item
.listing-post
a(href=post.url, title=post.title)= post.title
div.post-time
span.date= post.date.format("%m-%d")
你的模板越来越漂亮了。赞!
@角落里 感谢鼓励哈:)
你的模板越来越漂亮了。赞!
@角落里 感谢鼓励哈:)
博主是大名鼎鼎的caicai?
博主typed中的文章的那张悬浮注释,是怎么实现的?
@kmt007 您好,我并不是CaiCai,这个只是根据他当年的Farbox模板瞎折腾的一个爱好者Mod:)
关于您说的悬浮注释,我是用了一个叫bigfoot.js的插件,具体用法可以参考作者的官方[网站](http://www.bigfootjs.com)。
你的模板越来越漂亮了。赞!
@角落里 感谢鼓励哈:)
@角落里 感谢鼓励哈:)
@角落里 感谢鼓励哈:)
@角落里 感谢鼓励哈:)
@角落里 感谢鼓励哈:)
@角落里 感谢鼓励哈:)