为jekyll站点生成sitemap.xml

jekyll云分类

妙音 posted @ 2015年4月06日 16:48 in jekyll with tags jquery , 3627 阅读
分类太多,导致分类列表太长,页面很难看,该怎么办? 一个办法是改变展示形式. jquery正好有插件,可以让列表直接成为云标签.
  • 插件地址
https://github.com/addywaddy/jquery.tagcloud.js
插件本身用法非常简单,重点介绍在jekyll博客中的示例.
  • 新建模板(_includes/category_cloud.html)
<script type="text/javascript" src="{{ site.baseurl }}/static/js/jquery.tagcloud.js"></script>

<div id='category_cloud'>
    <h3>分类</h3>
    <div class="categories">
        {% for cat in site.categories\%}
        <a href="/categories.html#{{cat | first}}" rel="{{ cat|last|size  }}">{{cat | first}}</a>
        {% endfor \%}
    </div>
</div>
<script>
$.fn.tagcloud.defaults = {
  size: {start: 14, end: 18, unit: 'pt'},
  color: {start: '#555', end: '#428bca'}
};

$(function () {
  $('.categories a').tagcloud();
});
</script>
  • 包含模板  
在需要使用的地方包含category_cloud.html即可
<div class="well">
{% include category_cloud.html %}
</div>
 

登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter