Skip to content

Commit

Permalink
Documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
cdp1337 committed Oct 25, 2023
1 parent e0b1ddd commit 37bd7fa
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 100 deletions.
19 changes: 19 additions & 0 deletions docs/cms-icon.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
title: CMS Icon
---

Render an icon using FontAwesome, will auto-load the library if necessary.
If a "brand" icon is used, the brand library will be loaded.

**Parameters**


| Parameter | Required | Example | Description |
|-----------|----------|----------------|---------------------------------------|
| icon | yes | "user, gitlab" | Any valid icon present in FontAwesome |

**Example**

```.html
<cms-icon icon="gitlab"/>
```
18 changes: 18 additions & 0 deletions docs/cms-mastodon-share.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
title: Mastodon Share Button
---

Enables rendering of a mastodon share button on pages. Will allow the user to enter their instance URL.

**Parameters**

At the moment no parameters are configurable

**Example**

```.html
<cms-mastodon-share href="#" class="mastodon-share-button">
<cms-icon icon="mastodon"/>
Share on Mastodon
</cms-mastodon-share>
```
24 changes: 24 additions & 0 deletions docs/cms-pagelist.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
title: CMS Page List
---

Render a list of pages which match given parameters.

**Parameters**

| Parameter | Required | Example | Description |
|-----------|----------|------------------------|---------------------------------------------------------------------|
| type | yes | "posts,pages,etc" | Any valid content type defined on your site |
| layout | no | "post-list" | Layout to use for rendering content, useful for controlling UX |
| link | no | "^posts/subproject/.+" | Regex or regular string to match, will only include matchings files |
| sort | no | "datetime-r" | Sort results by a specific key |
| limit | no | 5 | Limit the number of results returned |
| filter-* | no | "filter-tag" | Filter results by a specific key |

**Example**

```.html
<cms-pagelist type="pages" layout="page-list" link="pages/games/" sort="title" limit="5">
Loading Content...
</cms-pagelist>
```
15 changes: 15 additions & 0 deletions docs/cms-search.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
title: CMS Search Input
---

Provides support for a search box on the site

**Parameters**

At the moment no parameters are configurable

**Example**

```.html
<cms-search type="search" placeholder="Search Site"/>
```
110 changes: 10 additions & 100 deletions docs/plugins-overview.md
Original file line number Diff line number Diff line change
@@ -1,62 +1,24 @@
---
title: CMS Plugins Overview
author: Charlie Powell
tags: Howto, Configuration
tags: [Howto, Configuration, Authoring]
---

There are a number of system plugins available by default. To save on performance however, these plugins are NOT enabled by default.
There are a number of system plugins and extras provided by default.

To enable plugins, use the following code. Multiple plugins can be included in a list of strings.

```.js
// Initialize CMS.js
var site = CMS(config);
site.init();

// Load some plugins
site.enablePlugin(['pagebodyclass', 'pagelist']);
```


## Plugins Available

| Plugin Key | Description |
|----------------|---------------------------------------------------------------|
| mastodon_share | Generates share links for Mastodon |
| pagebodyclass | Dynamically sets classnames on the body based on current page |
| pagelist | Provides support for embedding a list of pages |
| search | Provides support for search boxes |



### Plugin "mastodon_share"

Enables rendering of a mastodon share button on pages. Will allow the user to enter their instance URL.

**Parameters**

At the moment no parameters are configurable

**Example**

```.html
<a href="#" data-plugin="cms:mastodon_share" class="mastodon-share-button">
<i class="fab fa-mastodon"></i>
Share on Mastodon
</a>
```

**Renders (if enabled)**

<a href="#" data-plugin="cms:mastodon_share" class="mastodon-share-button">
<i class="fab fa-mastodon"></i>
Share on Mastodon
</a>
* [Author Tag](cms-author.md)
* [Button Tag](cms-button.md)
* [Icon Tag](cms-icon.md)
* [Mastodon Share Button](cms-mastodon-share.md)
* [Page List](cms-pagelist.md)
* [Search Box](cms-search.md)



### Plugin "pagebodyclass"

<!-- @todo move this to its own 'extra' group -->

Register classes on the body node based on the current page. Useful for styling page-specific themes.
Also provides support for updating navigation entries, (as an option).

Expand Down Expand Up @@ -85,55 +47,3 @@ site.getPlugin('pagebodyclass').navLinks = [
];
site.getPlugin('pagebodyclass').navSelector = '.nav';
```

**Renders (if enabled)**

N/A (check rendered sourcecode)



### Plugin "pagelist"

Generate a list of pages which match given parameters.

Any block-level HTML node (div, main, article, aside, etc), can be used, the plugin doesn't care.

**Parameters**

| Parameter | Required | Example | Description |
|-------------|----------|------------------------|---------------------------------------------------------------------|
| data-plugin | yes | "cms:pagelist" | Indicates to the plugin to use this element |
| data-type | yes | "posts,pages,etc" | Any valid content type defined on your site |
| data-layout | no | "post-list" | Layout to use for rendering content, useful for controlling UX |
| data-link | no | "^posts/subproject/.+" | Regex or regular string to match, will only include matchings files |
| data-sort | no | "datetime-r" | Sort results by a specific key |

**Example**

```.html
<div data-plugin="cms:pagelist" data-type="pages" data-layout="page-list" data-link="pages/games/" data-sort="title">
Loading Content...
</div>
```
**Renders (if enabled)**

<div data-plugin="cms:pagelist" data-type="pages" data-layout="page-list" data-link="pages/games/" data-sort="title">Loading Content...</div>



### Plugin "search"

Provides support for a search box on the site

**Parameters**

At the moment no parameters are configurable

**Example**

```.html
<input type="search" data-plugin="cms:search" placeholder="Search Site"/>
```
**Renders (if enabled)**

<input type="search" data-plugin="cms:search" placeholder="Search Site"/>

0 comments on commit 37bd7fa

Please sign in to comment.