summaryrefslogtreecommitdiff
path: root/docs/src/Interfaces
diff options
context:
space:
mode:
authorSteve Manuel <nilslice@gmail.com>2017-05-27 10:27:51 -0700
committerSteve Manuel <nilslice@gmail.com>2017-05-27 10:27:51 -0700
commit78de7ed98abff93fe5fef94907bcfa4f76dcef07 (patch)
treef58578554dc829a046762e588d8b190af89dd992 /docs/src/Interfaces
parent38aa0ebb1df97ff185d84da2d3c2f9a11888729b (diff)
adding docs to repo
Diffstat (limited to 'docs/src/Interfaces')
-rw-r--r--docs/src/Interfaces/API.md110
-rw-r--r--docs/src/Interfaces/Editor.md70
-rw-r--r--docs/src/Interfaces/Format.md48
-rw-r--r--docs/src/Interfaces/Item.md517
-rw-r--r--docs/src/Interfaces/Search.md44
5 files changed, 789 insertions, 0 deletions
diff --git a/docs/src/Interfaces/API.md b/docs/src/Interfaces/API.md
new file mode 100644
index 0000000..1d9ab82
--- /dev/null
+++ b/docs/src/Interfaces/API.md
@@ -0,0 +1,110 @@
+title: API Package Interfaces
+
+Ponzu provides a set of interfaces from the `system/api` package which enable
+richer interaction with your system from external clients. If you need to allow
+3rd-party apps to manage content, use the following interfaces.
+
+The API interfaces adhere to a common function signature, expecting an
+`http.ResponseWriter` and `*http.Request` as arguments and returning an `error`.
+This provides Ponzu developers with full control over the request/response
+life-cycle.
+
+---
+
+## Interfaces
+
+### [api.Createable](https://godoc.org/github.com/ponzu-cms/ponzu/system/api#Createable)
+Externalable enables 3rd-party clients (outside the CMS) to send content via a
+`multipart/form-data` encoded `POST` request to a specific endpoint:
+`/api/content/create?type=<Type>`. When `api.Createable` is implemented, content
+will be saved from the request in a "Pending" section which will is visible only
+within the CMS.
+
+To work with "Pending" data, implement the [`editor.Mergeable`](/Interfaces/Editor#editormergeable)
+interface, which will add "Approve" and "Reject" buttons to your Content types'
+editor -- or implement [`api.Trustable`](#apitrustable) to bypass
+the "Pending" section altogether and become "Public" immediately.
+
+##### Method Set
+
+```go
+type Createable interface {
+ Create(http.ResponseWriter, *http.Request) error
+}
+```
+
+##### Implementation
+```go
+func (p *Post) Create(res http.ResponseWriter, req *http.Request) error {
+ return nil
+}
+```
+
+---
+
+### [api.Updateable](https://godoc.org/github.com/ponzu-cms/ponzu/system/api#Updateable)
+Updateable enables 3rd-party clients (outside the CMS) to update existing content
+via a `multipart/form-data` encoded `POST` request to a specific endpoint:
+`/api/content/update?type=<Type>&id=<id>`. Request validation should be employed
+otherwise any client could change data in your database.
+
+##### Method Set
+
+```go
+type Updateable interface {
+ Update(http.ResponseWriter, *http.Request) error
+}
+```
+
+##### Implementation
+```go
+func (p *Post) Update(res http.ResponseWriter, req *http.Request) error {
+ return nil
+}
+```
+
+---
+
+### [api.Deleteable](https://godoc.org/github.com/ponzu-cms/ponzu/system/api#Deleteable)
+Updateable enables 3rd-party clients (outside the CMS) to delete existing content
+via a `multipart/form-data` encoded `POST` request to a specific endpoint:
+`/api/content/delete?type=<Type>&id=<id>`. Request validation should be employed
+otherwise any client could delete data from your database.
+
+##### Method Set
+
+```go
+type Deleteable interface {
+ Delete(http.ResponseWriter, *http.Request) error
+}
+```
+
+##### Implementation
+```go
+func (p *Post) Delete(res http.ResponseWriter, req *http.Request) error {
+ return nil
+}
+```
+
+---
+
+### [api.Trustable](https://godoc.org/github.com/ponzu-cms/ponzu/system/api#Trustable)
+Trustable provides a way for submitted content (via `api.Createable`) to bypass
+the `editor.Mergeable` step in which CMS end-users must manually click the
+"Approve" button in order for content to be put in the "Public" section and access
+via the content API endpoints. `api.Trustable` has a single method: `AutoApprove`
+which will automatically approve content, bypassing the "Pending" section
+altogether.
+
+```go
+type Trustable interface {
+ AutoApprove(http.ResponseWriter, *http.Request) error
+}
+```
+
+##### Implementation
+```go
+func (p *Post) AutoApprove(res http.ResponseWriter, req *http.Request) error {
+ return nil
+}
+``` \ No newline at end of file
diff --git a/docs/src/Interfaces/Editor.md b/docs/src/Interfaces/Editor.md
new file mode 100644
index 0000000..63d3ceb
--- /dev/null
+++ b/docs/src/Interfaces/Editor.md
@@ -0,0 +1,70 @@
+title: Editor Package Interfaces
+
+Ponzu provides a set of interfaces from the `management/editor` package which
+extend the system's functionality and determine how content editors are rendered
+within the CMS.
+
+---
+
+## Interfaces
+
+### [editor.Editable](https://godoc.org/github.com/ponzu-cms/ponzu/management/editor#Editable)
+
+Editable determines what `[]bytes` are rendered inside the editor page. Use
+Edtiable on anything inside your CMS that you want to provide configuration, editable
+fields, or any HTML/markup to display to an end-user.
+
+!!! note "Implementing `editor.Editable`"
+ Most of the time, Ponzu developers generate the majority of this code using
+ the Ponzu CLI [`generate` command](/CLI/Usage).
+
+##### Method Set
+
+```go
+type Editable interface {
+ MarshalEditor() ([]byte, error)
+}
+```
+
+##### Implementation
+
+```go
+func (p *Post) MarshalEditor() ([]byte, error) {
+ // The editor.Form func sets up a structured UI with default styles and form
+ // elements based on the fields provided. Most often, Ponzu developers will
+ // have the `$ ponzu generate` command generate the MarshalEditor func and
+ // its internal form fields
+ view, err := editor.Form(p,
+ editor.Field{
+ View: editor.Input("Name", p, map[string]string{
+ "label": "Name",
+ "type": "text",
+ "placeholder": "Enter the Name here",
+ }),
+ },
+ )
+}
+```
+
+!!! note "MarshalEditor() & View Rendering"
+ Although it is common to use the `editor.Form` and `editor.Fields` to structure your content editor inside `MarshalEditor()`, the method signature defines that its return value needs only to be `[]byte, error`. Keep in mind that you can return a `[]byte` of any raw HTML or other markup to be rendered in the editor view.
+
+---
+
+### [editor.Mergeable](https://godoc.org/github.com/ponzu-cms/ponzu/management/editor#Mergeable)
+
+Mergable enables a CMS end-user to merge the "Pending" content from an outside source into the "Public" section, and thus making it visible via the public content API. It also allows the end-user to reject content. "Approve" and "Reject" buttons will be visible on the edit page for content submitted.
+
+##### Method Set
+```go
+type Mergeable interface {
+ Approve(http.ResponseWriter, *http.Request) error
+}
+```
+
+##### Example
+```go
+func (p *Post) Approve(res http.ResponseWriter, req *http.Request) error {
+ return nil
+}
+```
diff --git a/docs/src/Interfaces/Format.md b/docs/src/Interfaces/Format.md
new file mode 100644
index 0000000..8a259d3
--- /dev/null
+++ b/docs/src/Interfaces/Format.md
@@ -0,0 +1,48 @@
+title: Format Package Interfaces
+
+Ponzu provides a set of interfaces from the `management/format` package which
+determine how content data should be converted and formatted for exporting via
+the Admin interface.
+
+---
+
+## Interfaces
+
+### [format.CSVFormattable](https://godoc.org/github.com/ponzu-cms/ponzu/management/format#CSVFormattable)
+
+CSVFormattable controls if an "Export" button is added to the contents view for
+a Content type in the CMS to export the data to CSV. If it is implemented, a
+button will be present beneath the "New" button per Content type.
+
+##### Method Set
+
+```go
+type CSVFormattable interface {
+ FormatCSV() []string
+}
+```
+
+##### Implementation
+
+```go
+func (p *Post) FormatCSV() []string {
+ // []string contains the JSON struct tags generated for your Content type
+ // implementing the interface
+ return []string{
+ "id",
+ "timestamp",
+ "slug",
+ "title",
+ "photos",
+ "body",
+ "written_by",
+ }
+}
+```
+
+!!! note "FormatCSV() []string"
+ Just like other Ponzu content extension interfaces, like `Push()`, you will
+ return the JSON struct tags for the fields you want exported to the CSV file.
+ These will also be the "header" row in the CSV file to give titles to the file
+ columns. Keep in mind that all of item.Item's fields are available here as well.
+
diff --git a/docs/src/Interfaces/Item.md b/docs/src/Interfaces/Item.md
new file mode 100644
index 0000000..32f250b
--- /dev/null
+++ b/docs/src/Interfaces/Item.md
@@ -0,0 +1,517 @@
+title: Item Package Interfaces
+
+Ponzu provides a set of interfaces from the `system/item` package which extend
+the functionality of the content in your system and how it interacts with other
+components inside and outside of Ponzu.
+
+---
+
+## Interfaces
+
+### [item.Pushable](https://godoc.org/github.com/ponzu-cms/ponzu/system/item#Pushable)
+Pushable, if [HTTP/2 Server Push](https://http2.github.io/http2-spec/#PushResources)
+is supported by the client, can tell a handler which resources it would like to
+have "pushed" preemptively to the client. This saves follow-on roundtrip requests
+for other items which are referenced by the Pushable item. The `Push` method, the
+only method in Pushable, must return a `[]string` containing the `json` field tags
+of the referenced items within the type.
+
+##### Method Set
+```go
+type Pushable interface {
+ // the values contained in fields returned by Push must be URL paths
+ Push() []string
+}
+```
+
+##### Implementation
+The `Push` method returns a `[]string` containing the `json` tag field names for
+which you want to have pushed to a supported client. The values for the field
+names **must** be URL paths, and cannot be from another origin.
+
+```go
+type Post struct {
+ item.Item
+
+ HeaderPhoto string `json:"header_photo"`
+ Author string `json:"author"` // reference `/api/content/?type=Author&id=2`
+ // ...
+}
+
+func (p *Post) Push() []string {
+ return []string{
+ "header_photo",
+ "author",
+ }
+}
+```
+
+---
+
+### [item.Hideable](https://godoc.org/github.com/ponzu-cms/ponzu/system/item#Hideable)
+Hideable tells an API handler that data of this type shouldn’t be exposed outside
+the system. Hideable types cannot be used as references (relations in Content types).
+The `Hide` method, the only method in Hideable, takes an `http.ResponseWriter, *http.Request`
+and returns an `error`. A special error in the `items` package, `ErrAllowHiddenItem`
+can be returned as the error from Hide to instruct handlers to show hidden
+content in specific cases.
+
+##### Method Set
+```go
+type Hideable interface {
+ Hide(http.ResponseWriter, *http.Request) error
+}
+```
+
+##### Implementation
+```go
+func (p *Post) Hide(res http.ResponseWriter, req *http.Request) error {
+ return nil
+}
+```
+
+---
+
+### [item.Omittable](https://godoc.org/github.com/ponzu-cms/ponzu/system/item#Omittable)
+Omittable tells a content API handler to keep certain fields from being exposed
+through the JSON response. It's single method, `Omit` takes no arguments and
+returns a `[]string` which must be made up of the JSON struct tags for the type
+containing fields to be omitted.
+
+##### Method Set
+```go
+type Omittable interface {
+ Omit() []string
+}
+```
+
+##### Implementation
+```go
+type Post struct {
+ item.Item
+
+ HeaderPhoto string `json:"header_photo"`
+ Author string `json:"author"`
+ // ...
+}
+
+func (p *Post) Omit() []string {
+ return []string{
+ "header_photo",
+ "author",
+ }
+}
+```
+
+---
+
+### [item.Hookable](https://godoc.org/github.com/ponzu-cms/ponzu/system/item#Hookable)
+Hookable provides lifecycle hooks into the http handlers which manage Save, Delete,
+Approve, and Reject routines. All methods in its set take an
+`http.ResponseWriter, *http.Request` and return an `error`.
+
+##### Method Set
+
+```go
+type Hookable interface {
+ BeforeAPICreate(http.ResponseWriter, *http.Request) error
+ AfterAPICreate(http.ResponseWriter, *http.Request) error
+
+ BeforeAPIUpdate(http.ResponseWriter, *http.Request) error
+ AfterAPIUpdate(http.ResponseWriter, *http.Request) error
+
+ BeforeAPIDelete(http.ResponseWriter, *http.Request) error
+ AfterAPIDelete(http.ResponseWriter, *http.Request) error
+
+ BeforeAdminCreate(http.ResponseWriter, *http.Request) error
+ AfterAdminCreate(http.ResponseWriter, *http.Request) error
+
+ BeforeAdminUpdate(http.ResponseWriter, *http.Request) error
+ AfterAdminUpdate(http.ResponseWriter, *http.Request) error
+
+ BeforeAdminDelete(http.ResponseWriter, *http.Request) error
+ AfterAdminDelete(http.ResponseWriter, *http.Request) error
+
+ BeforeSave(http.ResponseWriter, *http.Request) error
+ AfterSave(http.ResponseWriter, *http.Request) error
+
+ BeforeDelete(http.ResponseWriter, *http.Request) error
+ AfterDelete(http.ResponseWriter, *http.Request) error
+
+ BeforeApprove(http.ResponseWriter, *http.Request) error
+ AfterApprove(http.ResponseWriter, *http.Request) error
+
+ BeforeReject(http.ResponseWriter, *http.Request) error
+ AfterReject(http.ResponseWriter, *http.Request) error
+
+ // Enable/Disable used exclusively for addons
+ BeforeEnable(http.ResponseWriter, *http.Request) error
+ AfterEnable(http.ResponseWriter, *http.Request) error
+
+ BeforeDisable(http.ResponseWriter, *http.Request) error
+ AfterDisable(http.ResponseWriter, *http.Request) error
+}
+```
+
+##### Implementations
+
+#### BeforeAPICreate
+BeforeAPICreate is called before an item is created via a 3rd-party client. If a
+non-nil `error` value is returned, the item will not be created/saved.
+
+```go
+func (p *Post) BeforeAPICreate(res http.ResponseWriter, req *http.Request) error {
+ return nil
+}
+```
+
+#### AfterAPICreate
+AfterAPICreate is called after an item has been created via a 3rd-party client.
+At this point, the item has been saved to the database. If a non-nil `error` is
+returned, it will respond to the client with an empty response, so be sure to
+use the `http.ResponseWriter` from within your hook appropriately.
+
+```go
+func (p *Post) AfterAPICreate(res http.ResponseWriter, req *http.Request) error {
+ return nil
+}
+```
+
+#### BeforeApprove
+BeforeApprove is called before an item is merged as "Public" from its prior
+status as "Pending". If a non-nil `error` value is returned, the item will not be
+appproved, and an error message is displayed to the Admin.
+
+```go
+func (p *Post) BeforeApprove(res http.ResponseWriter, req *http.Request) error {
+ return nil
+}
+```
+
+#### AfterApprove
+AfterApprove is called after an item has been merged as "Public" from its prior
+status as "Pending". If a non-nil `error` is returned, an error message is
+displayed to the Admin, however the item will already be irreversibly merged.
+
+```go
+func (p *Post) AfterApprove(res http.ResponseWriter, req *http.Request) error {
+ return nil
+}
+```
+
+#### BeforeReject
+BeforeReject is called before an item is rejected and deleted by default. To reject
+an item, but not delete it, return a non-nil `error` from this hook - doing so
+will allow the hook to do what you want it to do prior to the return, but the item
+will remain in the "Pending" section.
+
+```go
+func (p *Post) BeforeReject(res http.ResponseWriter, req *http.Request) error {
+ return nil
+}
+```
+
+#### AfterReject
+AfterReject is called after an item is rejected and has been deleted.
+
+```go
+func (p *Post) AfterReject(res http.ResponseWriter, req *http.Request) error {
+ return nil
+}
+```
+
+#### BeforeSave
+BeforeSave is called before any CMS Admin or 3rd-party client triggers a save to
+the database. This could be done by clicking the 'Save' button on a Content editor,
+or by a API call to Create or Update the Content item. By returning a non-nil
+`error` value, the item will not be saved.
+
+```go
+func (p *Post) BeforeSave(res http.ResponseWriter, req *http.Request) error {
+ return nil
+}
+```
+
+#### AfterSave
+AfterSave is called after any CMS Admin or 3rd-party client triggers a save to
+the database. This could be done by clicking the 'Save' button on a Content editor,
+or by a API call to Create or Update the Content item.
+
+```go
+func (p *Post) AfterSave(res http.ResponseWriter, req *http.Request) error {
+ return nil
+}
+```
+
+#### BeforeDelete
+BeforeDelete is called before any CMS Admin or 3rd-party client triggers a delete to
+the database. This could be done by clicking the 'Delete' button on a Content editor,
+or by a API call to Delete the Content item. By returning a non-nil `error` value,
+the item will not be deleted.
+
+```go
+func (p *Post) BeforeDelete(res http.ResponseWriter, req *http.Request) error {
+ return nil
+}
+```
+
+#### AfterDelete
+AfterSave is called after any CMS Admin or 3rd-party client triggers a delete to
+the database. This could be done by clicking the 'Delete' button on a Content editor,
+or by a API call to Delete the Content item.
+
+```go
+func (p *Post) AfterDelete(res http.ResponseWriter, req *http.Request) error {
+ return nil
+}
+```
+
+#### BeforeAPIDelete
+BeforeDelete is only called before a 3rd-party client triggers a delete to the
+database. By returning a non-nil `error` value, the item will not be deleted.
+
+```go
+func (p *Post) BeforeAPIDelete(res http.ResponseWriter, req *http.Request) error {
+ return nil
+}
+```
+
+#### AfterAPIDelete
+AfterAPIDelete is only called after a 3rd-party client triggers a delete to the
+database.
+
+```go
+func (p *Post) AfterAPIDelete(res http.ResponseWriter, req *http.Request) error {
+ return nil
+}
+```
+
+#### BeforeAPIUpdate
+BeforeAPIUpdate is only called before a 3rd-party client triggers an update to
+the database. By returning a non-nil `error` value, the item will not be updated.
+
+```go
+func (p *Post) BeforeAPIUpdate(res http.ResponseWriter, req *http.Request) error {
+ return nil
+}
+```
+
+#### AfterAPIUpdate
+AfterAPIUpdate is only called after a 3rd-party client triggers an update to
+the database.
+
+```go
+func (p *Post) AfterAPIUpdate(res http.ResponseWriter, req *http.Request) error {
+ return nil
+}
+```
+
+#### BeforeAdminCreate
+BeforeAdminCreate is only called before a CMS Admin creates a new Content item.
+It is not called for subsequent saves to the item once it has been created and
+assigned an ID. By returning a non-nil `error` value, the item will not be created.
+
+```go
+func (p *Post) BeforeAdminCreate(res http.ResponseWriter, req *http.Request) error {
+ return nil
+}
+```
+
+#### AfterAdminCreate
+AfterAdminCreate is only called after a CMS Admin creates a new Content item.
+It is not called for subsequent saves to the item once it has been created and
+assigned an ID.
+
+```go
+func (p *Post) AfterAdminCreate(res http.ResponseWriter, req *http.Request) error {
+ return nil
+}
+```
+
+#### BeforeAdminUpdate
+BeforeAdminUpdate is only called before a CMS Admin updates a Content item. By
+returning a non-nil `error`, the item will not be updated.
+
+```go
+func (p *Post) BeforeAdminUpdate(res http.ResponseWriter, req *http.Request) error {
+ return nil
+}
+```
+
+#### AfterAdminUpdate
+AfterAdminUpdate is only called after a CMS Admin updates a Content item.
+
+```go
+func (p *Post) AfterAdminUpdate(res http.ResponseWriter, req *http.Request) error {
+ return nil
+}
+```
+
+#### BeforeAdminDelete
+BeforeAdminDelete is only called before a CMS Admin deletes a Content item. By
+returning a non-nil `error` value, the item will not be deleted.
+
+```go
+func (p *Post) BeforeAdminDelete(res http.ResponseWriter, req *http.Request) error {
+ return nil
+}
+```
+
+#### AfterAdminDelete
+AfterAdminDelete is only called after a CMS Admin deletes a Content item.
+
+```go
+func (p *Post) AfterAdminDelete(res http.ResponseWriter, req *http.Request) error {
+ return nil
+}
+```
+
+#### BeforeEnable
+BeforeEnable is only applicable to Addon items, and is called before the addon
+changes status to "Enabled". By returning a non-nil `error` value, the addon
+will not become enabled.
+
+```go
+func (p *Post) BeforeEnable(http.ResponseWriter, *http.Request) error {
+ return nil
+}
+```
+
+#### AfterEnable
+AfterEnable is only applicable to Addon items, and is called after the addon
+changes status to "Enabled".
+```go
+func (p *Post) AfterEnable(http.ResponseWriter, *http.Request) error {
+ return nil
+}
+```
+
+#### BeforeDisable
+BeforeDisable is only applicable to Addon items, and is called before the addon
+changes status to "Disabled". By returning a non-nil `error` value, the addon
+will not become disabled.
+```go
+func (p *Post) BeforeDisable(http.ResponseWriter, *http.Request) error {
+ return nil
+}
+```
+
+#### AfterDisable
+AfterDisable is only applicable to Addon items, and is called after the addon
+changes status to "Disabled".
+```go
+func (p *Post) AfterDisable(http.ResponseWriter, *http.Request) error {
+ return nil
+}
+```
+
+Hookable is implemented by Item by default as no-ops which are expected to be overridden.
+
+!!! note "Note"
+ returning an error from any of these `Hookable` methods will end the request,
+ causing it to halt immediately after the hook. For example, returning an `error`
+ from `BeforeDelete` will result in the content being kept in the database.
+ The same logic applies to all of these interface methods that return an error
+ - **the error defines the behavior**.
+
+---
+
+### [item.Identifiable](https://godoc.org/github.com/ponzu-cms/ponzu/system/item#Identifiable)
+Identifiable enables a struct to have its ID set/get. Typically this is done to set an ID to -1 indicating it is new for DB inserts, since by default a newly initialized struct would have an ID of 0, the int zero-value, and BoltDB's starting key per bucket is 0, thus overwriting the first record.
+Most notable, Identifiable’s `String` method is used to set a meaningful display name for an Item. `String` is called by default in the Admin dashboard to show the Items of certain types, and in the default creation of an Item’s slug.
+Identifiable is implemented by Item by default.
+
+##### Method Set
+```go
+type Identifiable interface {
+ ItemID() int
+ SetItemID(int)
+ UniqueID() uuid.UUID
+ String() string
+}
+```
+
+##### Implementation
+`item.Identifiable` has a default implementation in the `system/item` package.
+It is not advised to override these methods, with the exception of `String()`,
+which is commonly used to set the display name of Content items when listed in
+the CMS, and to customize slugs.
+
+```go
+func (i Item) ItemID() int {
+ return i.ID
+}
+
+func (i *Item) SetItemID(id int) {
+ i.ID = id
+}
+
+func (i Item) UniqueID() uuid.UUID {
+ return i.UUID
+}
+
+func (i Item) String() string {
+ return fmt.Sprintf("Item ID: %s", i.UniqueID())
+}
+```
+---
+
+### [item.Sluggable](https://godoc.org/github.com/ponzu-cms/ponzu/system/item#Sluggable)
+Sluggable makes a struct locatable by URL with it's own path. As an Item implementing Sluggable, slugs may overlap. If this is an issue, make your content struct (or one which embeds Item) implement Sluggable and it will override the slug created by Item's `SetSlug` method with your own.
+It is not recommended to override `SetSlug`, but rather the `String` method on your content struct, which will have a similar, more predictable effect.
+Sluggable is implemented by Item by default.
+
+##### Method Set
+```go
+type Sluggable interface {
+ SetSlug(string)
+ ItemSlug() string
+}
+```
+
+##### Implementation
+`item.Sluggable` has a default implementation in the `system/item` package. It is
+possible to override these methods on your own Content types, but beware, behavior
+is undefined. It is tempting to override the `SetSlug()` method to customize your
+Content item slug, but try first to override the `String()` method found in the
+`item.Identifiable` interface instead. If you don't get the desired results, try
+`SetSlug()`.
+
+```go
+func (i *Item) SetSlug(slug string) {
+ i.Slug = slug
+}
+
+func (i *Item) ItemSlug() string {
+ return i.Slug
+}
+```
+---
+
+
+### [item.Sortable](https://godoc.org/github.com/ponzu-cms/ponzu/system/item#Sortable)
+Sortable enables items to be sorted by time, as per the sort.Interface interface. Sortable is implemented by Item by default.
+
+##### Method Set
+```go
+type Sortable interface {
+ Time() int64
+ Touch() int64
+}
+```
+
+##### Implementation
+`item.Sortable` has a default implementation in the `system/item` package. It is
+possible to override these methods on your own Content type, but beware, behavior
+is undefined.
+
+```go
+func (i Item) Time() int64 {
+ return i.Timestamp
+}
+
+func (i Item) Touch() int64 {
+ return i.Updated
+}
+```
+
diff --git a/docs/src/Interfaces/Search.md b/docs/src/Interfaces/Search.md
new file mode 100644
index 0000000..a7cd0d1
--- /dev/null
+++ b/docs/src/Interfaces/Search.md
@@ -0,0 +1,44 @@
+title: Search Package Interfaces
+
+Ponzu provides a set of interfaces from the `system/search` package to enable and customize full-text search access to content in your system. **Search is not enabled by default**, and must be enabled per Content type individually.
+
+## Interfaces
+
+### [search.Searchable](https://godoc.org/github.com/ponzu-cms/ponzu/system/search#Searchable)
+Searchable determines how content is indexed and whether the system should index the content when it is created and updated or be removed from the index when content is deleted.
+
+!!! warning ""
+ Search is **disabled** for all Content items by default. Each Content item that should be indexed and searchable must implement the `search.Searchable` interface.
+
+##### Method Set
+
+```go
+type Searchable interface {
+ SearchMapping() (*mapping.IndexMappingImpl, error)
+ IndexContent() bool
+}
+```
+
+By default, Ponzu sets up the [Bleve's](http://blevesearch.com) "default mapping", which is typically what you want for most content-based systems. This can be overridden by implementing your own `SearchMapping() (*mapping.IndexMappingImpl, error)` method on your Content type.
+
+This way, all you need to do to get full-text search is to add the `IndexContent() bool` method to each Content type you want search enabled. Return `true` from this method to enable search.
+
+
+##### Example
+```go
+// ...
+
+type Song struct {
+ item.Item
+
+ Name string `json:"name"`
+ // ...
+}
+
+func (s *Song) IndexContent() bool {
+ return true
+}
+```
+
+!!! tip "Indexing Existing Content"
+ If you previously had search disabled and had already added content to your system, you will need to re-index old content items in your CMS. Otherwise, they will not show up in search queries.. This requires you to manually open each item and click 'Save'. This could be scripted and Ponzu _might_ ship with a re-indexing function at some point in the fututre.