-
May
07
-
在Jekyll中使用分页功能
Jekyll默认支持分页功能,然而仅支持在html文件中使用,而不支持markdown。您可以通过以下步骤为你的博客添加分页功能:
修改
_config.yml
配置文件添加以下选项:
markdown: rdiscount pygments: true lsi: true exclude: ['README.markdown', 'README_FOR_COLLABORATORS.markdown', 'Gemfile.lock', 'Gemfile'] production: false //add this line to add pagination paginate: 3 //the number of post per page
在html文件中使用paginator
示例代码如下:
<p class="previous disabled"> <span>Previous</span> </p> <ul class="pages"> <li class="page"> <a href="/">1</a> </li> </ul> <p class="next disabled"> <span>Next</span> </p>
需要说明的是,上述代码并不会产生一个名为page1的文件夹,所以当您点击第1页会会提示页面不存在。以下代码则解决了这个问题:
现在分页功能已经完成了。当然,这个分页器看上去很丑陋,您可以定制它的CSS样式。
-
May
04
-
Pygments安装教程
在Windows环境下安装Pygments
安装Python
安装Python通常有两种方法:
-
安装ActivePython
-
安装来自Python.org的Python
安装easy_install
-
下载脚本:http://peak.telecommunity.com/dist/ez_setup.py
-
执行ez_setup.py。可以在 IDLE中通过文件菜单打开脚本,然后Ctrl + F5执行。
-
添加环境变量,比如:C:\Python\Scripts\
安装Pygments
打开命令提示符,执行:
puts "Hello,world!"
生成css文件:
pygmentize -S default -f html > css/pygments/default.css
在html中包括css文件
安装补丁
为了防止出现错误:
Liquid eror: bad file descriptor
,你需要安装该补丁(下载地址)。然后执行以下命令:1 cd /c/Ruby192/lib/ruby/gems/1.9.1/gems/albino-1.3.3/lib; 2 patch < 0001-albino-windows-refactor.patch
参见:http://bradleygrainger.com/2011/09/07/how-to-use-github-pages-on-windows.html
-
-
May
04
-
Jekyll中的日期格式化
Jekyll uses Liquid for its template language. It’s worth reading over the Liquid for designers page to get a basic understanding of what’s available. The specific reference for date manipulation can be found here: Liquid date formatting. To do the specific output you are looking for (e.g. “12 September 2011”), you would change your initial “05-04-2012” to: 04 May 2012 Side note: In some places you will need to use “post.date” instead of “page.date”. If “page.date” doesn’t produce any output, try the “post” version. 转自:Stack Overflow 原文:http://stackoverflow.com/questions/7395520/jekyll-date-format