@@ -3,43 +3,89 @@ title: Your First Blog Post
3
3
slug : your-first-blog-post
4
4
chapter : 3
5
5
---
6
- _ posts directory is built-in feature for all Jekyll sites.
7
- Files you add under here are part of the "posts" collection.
8
- The file name convention provides date based sorting
9
6
10
- Let's create your first post and discuss Jekyll source file structure
11
7
12
- ## Rename the existing post
8
+ __ posts_ directory is a built-in feature for all Jekyll sites.
9
+ Files you add under here are part of the "site.posts" collection.
10
+ Jekyll uses a file name convention to provide date metadata and sorting.
11
+
12
+ # Create your first post, dated for today.
13
+
14
+ ## Open the __ posts_ directory, rename the file for today's date
13
15
14
16
```
15
17
> cd _posts
16
- > mv 2014-3-3-Hello-World.md 2018-10-7 -Hello-World.md
18
+ > mv 2014-3-3-Hello-World.md 2018-10-18 -Hello-World.md
17
19
```
20
+ <details >
21
+ <summary >Quiz: What file standardizes the look and feel of this post?</summary >
22
+ <strong >_ layouts/post.html</strong >
23
+ </details >
24
+
18
25
19
- The date in the file name becomes the date of the post.
20
26
21
- ## Open the renamed file
22
- Jekyll transforms files that contain the front matter header
27
+ ## Edit the File
23
28
29
+ ### Change your post's title in the _ front matter_
30
+
31
+ _ front matter_ is the top section of the file between the two dash lines.
32
+ It defines a section of the file that contains variables and variable overrides
33
+ for this piece of content, the "page" scope.
24
34
``` jekyll
25
35
---
26
36
layout: post
27
37
title: I'm up and running!
28
38
---
29
39
```
30
40
31
- Front matter declares properties for the 'page' scope. Templates and includes
32
- have access to the page scope during processing.
41
+ ### Create your own post body
42
+ Everything under the front matter becomes the _ content_ of your blog post.
43
+ Since this is an _ .md_ file, you can do some simple formatting
44
+ with [ Markdown] ( https://guides.github.com/pdfs/markdown-cheatsheet-online.pdf ) {: target ="_ blank"}
33
45
34
- The content under the front matter becomes the main body of the page.
46
+ <details >
47
+ <summary >If you are new to markdown</summary >
48
+ <ul >
49
+ <li ># Is a Top, level 1 heading < ; h1> ; </li >
50
+ <li >## takes the heading down one notch</li >
51
+ <li >* indicates a list item</li >
52
+ <li >_italics here_</li >
53
+ </ul >
54
+ </details >
35
55
36
- ## Quiz: What does Jekyll do with this new _ posts file?
56
+ ``` markdown
57
+ Blogging like a hacker at Connect Tech 2018!
58
+ ```
59
+ ## Save and commit your changes
37
60
38
- <details >
39
- <summary >Answer</summary >
40
- <ul >
41
- <li>Rendered files are placed under _site directory</li>
42
- <li>A new file shows up under the site root</li>
43
- <li>It is a complete, static html file</li>
44
- </ul >
45
- </details >
61
+ # While We Wait
62
+ Jekyll is now re-rendering your site, and will show your new post shortly.
63
+ While that happens, let's take another look at templating and rendering.
64
+
65
+ ## File name into Date variables
66
+ Jekyll parses the page.date variable from the file name. The post layout
67
+ uses a liquid filter to control date format output.
68
+
69
+ {% raw %}
70
+ ```
71
+ Written on {{ page.date | date: "%B %e, %Y" }}
72
+ ```
73
+ {% endraw %}
74
+
75
+ [ Filters] ( https://jekyllrb.com/docs/liquid/filters/ ) {: target ="_ blank"}
76
+ are the mechanism to do logic based formatting in Liquid Templates.
77
+
78
+ _ (Don't worry, you'll try some out in the next section.)_
79
+
80
+ ## Rendered content ends up in __ site_ directory
81
+ If you are working with a local build, Jekyll outputs all rendered pages
82
+ to the __ site_ directory. Since we're dealing with static pages Jekyll
83
+ relies on the * permalink* property for the final output file name. You can
84
+ move a source file anywhere, Jekyll writes the output to folders and files based
85
+ on permalink pattern defined.
86
+
87
+ | permalink | output under site | url |
88
+ | /: title | _ site/page-title | /page-title |
89
+ | /: title / | _ site/page-title/index.html | /page-title/ |
90
+ | /: collection /: title | _ site/folder/page-title | /folder/page-title |
91
+ | /: collection /: title / | _ site/folder/page-title/index.html | /folder/page-title/ |
0 commit comments