Skip to content

Commit

Permalink
docs: addCollection API method
Browse files Browse the repository at this point in the history
  • Loading branch information
paulrobertlloyd committed Nov 23, 2024
1 parent 426d06d commit d65b951
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/.vitepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ const sidebar = [

const sidebarApi = [
{ text: "Introduction", link: "/api/" },
{
text: "<code>Indiekit.addCollection</code>",
link: "/api/add-collection",
},
{
text: "<code>Indiekit.addEndpoint</code>",
link: "/api/add-endpoint",
Expand Down
18 changes: 18 additions & 0 deletions docs/api/add-collection.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
outline: deep
---

# `Indiekit.addCollection`

This method is enables plug-ins to add a new collection to the MongoDB database for storing data.

## Syntax

```js
new Indiekit.addCollection(name);
```

## Constructor

`name`
: Collection name. This cannot share the name of a collection added by another plug-in. Indiekit currently adds 2 collections: `posts` and `media`.
2 changes: 2 additions & 0 deletions docs/api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ A plug-in can provide any of the following features:
* [content store functions](add-store.md)
* [syndication functions](add-syndicator.md)

A plug-in can also [add a collection](add-collection.md) to the MongoDb database.

## Anatomy of a plug-in

A plug-in is a `Class` with an `init()` function that is used to register endpoints, presets, stores and syndicators. You can also use the `init()` function to modify Indiekit’s [configuration](../configuration/index.md). For example:
Expand Down

0 comments on commit d65b951

Please sign in to comment.