Code collection of jekyll theme used! (Jekyll模板定制时可能用到的一些代码)
<ul>
{% for post in site.posts %}
{% capture y %}{{post.date | date:"%Y"}}{% endcapture %}
{% if year != y %}
{% assign year = y %}
<h2>{{ post.date | date: '%Y' }}</h2>
{% endif %}
<li>
<h4><span>{{ post.date | date:"%Y-%m-%d" }}</span>»
<a href="{{ post.url }}" title="{{ post.title }}">{{ post.title }}</a></h4>
</li>
{% endfor %}
</ul>
{% for tag in site.tags %}
<a name="{{ tag[0] }}"></a><h3>{{ tag[0] }}({{ tag[1].size }})</h3>
<ul>
{% for post in tag[1] %}
<li><span>{{ post.date | date_to_string }}</span> » <a href="{{ post.url }}">{{ post.title }}</a></li>
{% endfor %}
</ul>
{% endfor %}
<ul>
{% for cat in site.categories %}
{% if cat[0] != 'blog' %}
<a name="{{ cat[0] }}"></a>
<h2>{{ cat[0] }}({{ cat[1].size }})</h2>
{% for post in cat[1] %}
<li><h4><span>{{ post.date | date_to_string }}</span> » <a href="{{ post.url }}">{{ post.title }}</a></h4></li>
{% endfor %}
{% endif %}
{% endfor %}
</ul>
<ul>
{% for post in site.categories.XXX %}
{% capture y %}{{post.date | date:"%Y"}}{% endcapture %}
{% if year != y %}
{% assign year = y %}
<h2>{{ post.date | date: '%Y' }}</h2>
{% endif %}
<li>
<h4><span>{{ post.date | date:"%Y-%m-%d" }}</span>»
<a href="{{ post.url }}" title="{{ post.title }}">{{ post.title }}</a></h4>
</li>
{% endfor %}
</ul>
<ul>
{% for post in site.posts limit:10 %}
<li>
<a href="{{ post.url }}">
{{ post.title }}
</a>
</li>
{% endfor %}
</ul>
<ul>
{% for post in site.related_posts limit:10 %}
<li>
<a href="{{ post.url }}">
{{ post.title }}
</a>
</li>
{% endfor %}
</ul>
---
layout: nil
title : Atom Feed
---
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>{{ site.title }}</title>
<link href="http://{{ site.domain }}/atom.xml" rel="self"/>
<link href="http://{{ site.domain }}"/>
<updated>{{ site.time | date_to_xmlschema }}</updated>
<author>
<name>{{ site.author }}</name>
<email>{{ site.email }}</email>
</author>
{% for post in site.posts %}
<entry>
<title>{{ post.title }}</title>
<link href="http://{{ site.domain }}{{ post.url }}"/>
<updated>{{ post.date | date_to_xmlschema }}</updated>
<id>{{ site.production_url }}{{ post.id }}</id>
<content type="html">{{ post.content | xml_escape }}</content>
</entry>
{% endfor %}
</feed>