|
@@ -52,6 +52,8 @@ be seamlessly picked up by *coleslaw* and included on the rendered site.
|
52
|
52
|
All current Content Types and Indexes implement the protocol faithfully.
|
53
|
53
|
It consists of 2 "class" methods, 2 instance methods, and an invariant.
|
54
|
54
|
|
|
55
|
+There are also 4 helper functions provided that should prove useful in
|
|
56
|
+implementing new content types.
|
55
|
57
|
|
56
|
58
|
**Class Methods**:
|
57
|
59
|
|
|
@@ -84,6 +86,22 @@ implement them by eql-specializing on the class, e.g.
|
84
|
86
|
the site's git repo with the lowercased class-name as a file extension,
|
85
|
87
|
i.e. (".post" for POST files).
|
86
|
88
|
|
|
89
|
+**Protocol Helpers**:
|
|
90
|
+
|
|
91
|
+- `add-document`: Add the document to *coleslaw*'s in-memory
|
|
92
|
+ database. It will error if the `page-url` of the document is not
|
|
93
|
+ unique. Such a hash collision represents content on the site being
|
|
94
|
+ shadowed/overwritten. This should be used in your `discover` method.
|
|
95
|
+- `write-document`: Write the document out to disk as HTML. It takes
|
|
96
|
+ an optional template name and render-args to pass to the template.
|
|
97
|
+ This should be used in your `publish` method.
|
|
98
|
+- `find-all`: Return a list of all documents of the requested class.
|
|
99
|
+ This is often used in the `publish` method to iterate over documents
|
|
100
|
+ of a given type.
|
|
101
|
+- `purge-all`: Remove all instances of the requested class from the DB.
|
|
102
|
+ This is primarily used at the REPL or for debugging but it is also
|
|
103
|
+ used in a `:before` method on `discover` to keep it idempotent.
|
|
104
|
+
|
87
|
105
|
### Current Content Types & Indexes
|
88
|
106
|
|
89
|
107
|
There are 5 INDEX subclasses at present: TAG-INDEX, MONTH-INDEX,
|