TeensyCMS

A very small, very minimal CMS for allowing admins deploying your web applications to add custom pages and have them accessible from a nav bar.

A typical application using TeensyCMS dos so like this:

That's it.

A typical use case for this would be if you wanted a admin to be able to provide their own pages that may or maybe not include:

A full working example of a website implementing TeensyCMS can be found in the examples/ directory and run with cargo run, but for reference a simple app might look like this:

```rust use teensy_cms::{TeensyCms, Page}; use serde::{Serialize, Deserialize};

// this page struct is defined by the application developer // the fields here are the "contract" for what a developer can use in their templates

[derive(Serialize, Deserialize)]

struct MyPage { title: String, url: String, }

impl Page for MyPage { fn title(&self) -> String { self.title.clone() } fn url(&self) -> String { self.url.clone() } }

let myconfig = MyConfig::fromenv(); let cms = TeensyCms::::frompath( // the value of the URL prefix is controlled by the applicaiton developer "/hardcoded/pages/url/path", // the value of the pagesdir is controlled by the application admin &myconfig.pagesdir, ).unwrap(); // finish initializing the web server

// imagine some fancy routing macro that wraps this fn handlepagerequest(req: Request) -> String { // something like "contact" or "about" let page = &req.path_args()["page"]; req.data::>().unwrap() .render(&format!("{page}.html")).unwrap() } ```

A page looks like the following:

```yaml

title: My Page url: /my-page

cats: [Scruffles, Mx. Clawz]

{{ page.title }}

```

Anti-Copyright

Intellectual property isn't real. There is no license. If you insist on having one, this is Creative Commons Zero (public domain).