[Step by Step Tutorial] 08. Blogging
์ด์ ๋ฐ์ดํฐ๋ฒ ์ด์ค ์์ด ์ด๋ป๊ฒ ๋ธ๋ก๊ทธ๋ฅผ ๋ง๋ค ์ ์๋์ง ๊ถ๊ธํ ๊ฒ์ด๋ค. Jekyll ์คํ์ผ์์ ์ค๋ก์ง text ํ์ผ๋ง์ผ๋ก bloggingํ๋ ๊ฒ์ด ๊ฐ๋ฅํ๋ค.
#
Posts๋ธ๋ก๊ทธ ํฌ์คํธ๋ _posts
๋ผ๋ ํด๋์ ์๋ค. ํฌ์คํธ์ ํ์ผ๋ช
์ ํน๋ณํ ํฌ๋งท์ ๊ฐ์ง๋๋ฐ ๋ฐํ์ผ, ์ ๋ชฉ, ํ์ฅ์ ์ด๋ค.
์ฒซ ํฌ์คํธ๋ฅผ _posts/2018-08-20-bananas.md
๋ก ๋ง๋ค์ด๋ณด์.
---layout: postauthor: jill---A banana is an edible fruit โ botanically a berry โ produced by several kindsof large herbaceous flowering plants in the genus Musa.
In some countries, bananas used for cooking may be called "plantains",distinguishing them from dessert bananas. The fruit is variable in size, color,and firmness, but is usually elongated and curved, with soft flesh rich instarch covered with a rind, which may be green, yellow, red, purple, or brownwhen ripe.
์ด๊ฒ์ ์ด๋ป๊ฒ ๋ณด๋ฉด about.md
ํ์ผ๊ณผ ๋น์ทํด ๋ณด์ด๋๋ฐ, author
๋ผ๋ ์ปค์คํ
๋ณ์๊ฐ ์๊ณ (๊ผญ ํ์ํ ๊ฒ์ ์๋๊ณ creator
๋ผ๋ ์ด๋ฆ์ผ๋ก ์ฌ์ฉํ ์๋ ์๋ค.) layout
์ด ๋ค๋ฅด๋ค.
#
Layoutpost
๋ผ๋ ๋ ์ด์์์ด ์๊ธฐ ๋๋ฌธ์, _layouts/post.html
์ ๋ง๋ค ํ์๊ฐ ์๋ค.
---layout: default---<h1>{{ page.title }}</h1><p>{{ page.date | date_to_string }} - {{ page.author }}</p>
{{ content }}
์ด๊ฒ์ ๋ ์ด์์์ ์์์ ์์ด๋ค. post
๋ ์ด์์์ title
, date
, author
, content
๋ฅผ ํ์ํ๊ณ ์ด๊ฒ์ default
๋ ์ด์์์ผ๋ก ๊ฐ์ธ์ง๋ค.
๋ํ date_to_string
ํํฐ๋ ๋ ์ง๋ฅผ ๋ณด๊ธฐ ์ข์ ํ์์ผ๋ก ํ์ํด์ค๋ค.
#
List postsํ์ฌ blog ํฌ์คํธ๋ค์ navigateํ๋ ๋ฐฉ๋ฒ์ด ์๋ค. ์ ํ์ ์ผ๋ก ๋ธ๋ก๊ทธ๋ ๋ชจ๋ ํฌ์คํธ๋ฅผ๋ฆฌ์คํธํ๋ ํ์ด์ง๋ฅผ ๊ฐ๊ณ ์๋ค.
Jekyll์์๋ ํฌ์คํธ๋ค์ site.posts
๋ก ์ ๊ทผํ ์ ์๋ค.
blog.html
์ ๋ฃจํธ ๋๋ ํ ๋ฆฌ์ ๋ง๋ ๋ค.
---layout: defaulttitle: Blog---<h1>Latest Posts</h1>
<ul> {% for post in site.posts %} <li> <h2><a href="{{ post.url }}">{{ post.title }}</a></h2> <p>{{ post.excerpt }}</p> </li> {% endfor %}</ul>
์ด ์ฝ๋์์ ์ ์ํ ๋ถ๋ถ์
post.url
์ ํฌ์คํธ์ output path๋ฅผ Jekyll์ด ์ฐพ์์ค๋ค.post.title
์ ํฌ์คํธ์ ํ์ผ ์ด๋ฆ์์title
์ ๊ฐ์ ธ์ค๋๋ฐ front matter์title
์ผ๋ก override ํ ์ ์๋ค.post.excerpt
๋ ๊ธฐ๋ณธ์ ์ผ๋ก ์ฝํ ์ธ ์ ์ฒซ ๋ฒ์งธ ๋จ๋ฝ์ ๊ฐ์ ธ์จ๋ค.
๋ํ ์ฐ๋ฆฌ๋ ๊ธฐ๋ณธ ํ์ด์ง์์๋ถํฐ Blog ํ์ด์ง๋ก ๊ฐ ์ ์๋ ๋ฐฉ๋ฒ์ด ๋ค๋น๊ฒ์ด์
์ ์ถ๊ฐ๋์ด์ผ ํ๋ฏ๋ก _data/navigation.yml
ํ์ผ์ blog page๋ฅผ ์ํ ์ํธ๋ฆฌ๋ฅผ ์ถ๊ฐํ๋ค .
- name: Home link: /- name: About link: /about.html- name: Blog link: /blog.html
#
More postsblog์ ์ฌ๋ฌ ํฌ์คํธ๋ฅผ ์ถ๊ฐํด๋ณธ๋ค.
_posts/2018-08-21-apples.md
---layout: postauthor: jill---An apple is a sweet, edible fruit produced by an apple tree.Apple trees are cultivated worldwide, and are the most widely grown species inthe genus Malus. The tree originated in Central Asia, where its wild ancestor,Malus sieversii, is still found today. Apples have been grown for thousands ofyears in Asia and Europe, and were brought to North America by Europeancolonists.
_posts/2018-08-22-kiwifruit.md
:
---layout: postauthor: ted---Kiwifruit (often abbreviated as kiwi), or Chinese gooseberry is the edibleberry of several species of woody vines in the genus Actinidia.The most common cultivar group of kiwifruit is oval, about the size of a largehen's egg (5โ8 cm (2.0โ3.1 in) in length and 4.5โ5.5 cm (1.8โ2.2 in) indiameter). It has a fibrous, dull greenish-brown skin and bright green orgolden flesh with rows of tiny, black, edible seeds. The fruit has a softtexture, with a sweet and unique flavor.
http://localhost:4000๋ฅผ ์ด์ด ํ์ธํด๋ณธ๋ค.