jekyll snippet

이미지 오른쪽 정렬

img {
  display: block;
  margin-left: auto;
  margin-right: auto;
  border-radius: 5px;
}
.rimg {
  display: block;
  margin-right: 0;
  border-radius: 5px;
}
.limg {
  display: block;
  margin-left: 0;
  border-radius: 5px;
}

이미지 넘침 방지

.page img,
.post img {
  max-width: 100%;
  height: auto;
}

포스트 날짜 형식 변경


{{ post.date | date: "%Y/%m/%d" }}

baseurl 삽입


{{ '/css/main.css' | prepend: site.baseurl }}

이전, 이후 포스트 링크


<hr>
{% if page.previous %}
    <a class="internal" rel="prev"  href="{{ site.baseurl }}{{ page.previous.url }}" title="View {{ page.previous.title }}">&laquo; {{ page.previous.title }}</a></li>
{% endif %}
{% if page.previous and page.next %}
    | </li>
{% endif %}
{% if page.next %}
    <a class="internal" rel="next"  href="{{ site.baseurl }}{{ page.next.url }}" title="View {{ page.next.title }}">{{ page.next.title }} &raquo;</a></li>
{% endif %}

tag 페이지

---
layout: page
title: Tags
header: Posts By Tag
group: navigation
permalink: /tags
---


{% for tag in site.tags %}
<h2 id="{{ tag[0] }}-ref">{{ tag[0] }}</h2>

<ul>
{% for post in tag[1] %}
<li><a href="{{ site.baseurl }}{{ post.url }}">{{ post.title }}</a></li>
{% endfor %}
</ul>
{% endfor %}

category 페이지

---
layout: page
title: Categories
header: Posts By Category
group: navigation
permalink: /categories
---


{% for category in site.categories %}
<h2 id="{{ category[0] }}-ref">{{ category[0] | join: "/" }}</h2>

<ul>
{% for post in category[1] %}
<li><a href="{{ site.baseurl }}{{ post.url }}">{{ post.title }}</a></li>
{% endfor %}
</ul>
{% endfor %}


archive 페이지

post에 tag, category 링크 추가

Jekyll Bootstrap 테마 참고

html


{% if page.categories.size > 0 %}
<ul class="list-category list-linear">
<li class="list-head">category: </li>

{% if page.categories.first[0] == null %}
    {% for category in page.categories %}
        <li><a href="{{ site.baseurl }}/categories.html#{{ category }}-ref">
            {{ category | join: "/" }} <span>{{ site.categories[category].size }}</span>
        </a></li>
    {% endfor %}
{% else %}
    {% for category in categories_list %}
        <li><a href="{{ site.baseurl }}/categories.html#{{ category[0] }}-ref">
        {{ category[0] | join: "/" }} <span>{{ category[1].size }}</span>
    </a></li>
    {% endfor %}
{% endif %}
</ul>
{% endif %}

{% if page.tags.size > 0 %}
<ul class="list-tag list-linear">
<li class="list-head">tags: </li>

{% if page.tags.first[0] == null %}
    {% for tag in page.tags %}
        <li><a href="{{ site.baseurl }}/tags.html#{{ tag }}-ref">{{ tag }} <span>{{ site.tags[tag].size }}</span></a></li>
    {% endfor %}
{% else %}
    {% for tag in page.tags %}
        <li><a href="{{ site.baseurl }}/tags.html#{{ tag[0] }}-ref">{{ tag[0] }} <span>{{ tag[1].size }}</span></a></li>
    {% endfor %}
{% endif %}

</ul>
{% endif %}

css

.list-linear {
  letter-spacing: -0.31em;
  *letter-spacing: normal;
  word-spacing: -0.43em;
  list-style: none;
  padding-left: 0;
}
.list-linear li {
  display: inline-block;
  *display: inline;
  zoom: 1;
  line-height: normal;
  letter-spacing: normal;
  margin-right: 16px;
  word-spacing: normal;
  vertical-align: middle;
}
.list-linear li:last-child {
  margin-right: 0;
}

.list-category a,
.list-tag a {
  border: 0 none;
}
.list-category a:hover span,
.list-tag a:hover span {
  background-color: #f99157;
}
.list-category span,
.list-tag span {
  background-color: #e25608;
  padding: 1px 5px;
  -webkit-border-radius: 10px;
  -moz-border-radius: 10px;
  border-radius: 10px;
  color: white;
  text-transform: uppercase;
  margin: 0 6px 0 0;
  display: inline-block;
  position: relative;
  vertical-align: middle;
  top: -2px;
  font-weight: bold;
  font-size: 13px;
}
.list-category {
  margin-bottom: 0;
}
.list-tag {
}