@@ -3,33 +3,78 @@ title: Add a Custom Collection
3
3
slug : add-a-new-collection
4
4
chapter : 6
5
5
---
6
- Goal: Rather than flood your new blog site with individual entries for all
7
- the talks you attend at Connect.tech. Use a collection to hold individual entries
8
- and provide your readers with a succinct listing of events you attended.
9
6
10
7
## Step 1: Create the collection's directory
11
- Under your project root, create a folder named "_ connecttech2018", the prefix
12
- underscore is important, why?
13
- Hint: How does Jekyll know what to copy to _ site?
8
+ Under your project root, create a folder named "_ connecttech2018"
9
+ and add an index file
10
+
11
+ ```
12
+ > mkdir _connecttech2018
13
+ > touch index.md
14
+ ```
15
+ <details >
16
+ <summary ><strong >Quiz:</strong >the prefix underscore is important, why?</summary >
17
+ Indicates to Jekyll this is a file it needs to process.
18
+ </details >
19
+
20
+ <details >
21
+ <summary >Working Directly On Github?</summary >
22
+ Github will not let you create an empty directory, however if you add
23
+ the directory to the filename, it will be created.
24
+ </details >
14
25
15
26
16
27
## Step 2: Tell Jekyll about your Collection
17
28
* Open up _ config.yml
18
29
* Add a new object called "collections"
19
30
* Add a child to collections called "connecttech2018"
20
31
* Add a property "output: true" to your connecttech2018 collection.
21
- * Restart jekyll
22
- Note: we'll talk more about defining collections in a bit
23
32
33
+ ``` yaml
34
+ collections :
35
+ connecttech2018 :
36
+ output : true
37
+ ` ` `
38
+
39
+ <details>
40
+ <summary>Working with Jekyll locally?</summary>
41
+ Restart Jekyll Server. _config.yml is the one file Jekyll doesn't watch for changes
42
+ </details>
24
43
25
- ## Step 3: Add a new file as first item
44
+ ## Step 3: Add Some Content
26
45
27
- * create file "note1 .md"
46
+ * create file "_connecttech2018/jekyll-4-fun .md"
28
47
* add an empty jekyll front matter
29
- * use md or html for the content body
48
+ * Add text into the body.
49
+
50
+ ` ` `
51
+ ---
52
+ ---
53
+ Learning To Rock Jekyll at Connect Tech!
54
+ ```
55
+ ## Save and Commit your changes
56
+
57
+ ## Step 4: Test your collection.
58
+
59
+ * https://<yoursite >.github.io/connecttech2018/
60
+ * https://<yoursite >.github.io/connecttech2018/jekyll-4-fun/
61
+
62
+ <strong >Explore! How does Jekyll handle?</strong >
63
+
64
+ <details >
65
+ <summary >The layout for your index & item page?</summary >
66
+ There is none! Why not?
67
+ </details >
30
68
31
- ## Test your collection:
69
+ <details >
70
+ <summary >The title for the index and item page?</summary >
71
+ Uses the filename.
72
+ </details >
32
73
33
- * Browse to yoursite/connecttech2018
34
- * What does Jekyll use when no properties define layout, title or permalink?
35
- * How does the note one look?
74
+ <details >
75
+ <summary >Where are files output?</summary >
76
+ _ site/ <br />
77
+   ;  ; connecttech2018.html <br />
78
+   ;  ; connecttech2018/ <br />
79
+   ;  ;  ;  ; jekyll-4-fun.html <br />
80
+ </details >
0 commit comments