diff --git a/Using-mlem.md b/Using-mlem.md new file mode 100644 index 0000000..7bd8a8a --- /dev/null +++ b/Using-mlem.md @@ -0,0 +1,43 @@ +# Using mlem +Some prerequisites before you can use mlem are: +- A Rust Compiler +- Knowledge of HTML +- Knowledge of Markdown + +## Writing a config + +Mlem expects a `mlem.toml` in its execution directory to work. You can generate the config by running `mlem create` . The default config file it creates looks like this: + +```toml +output_dir = "output" +src_dir = "md_src" +templates_dir = "templates" +``` +You can change all these values later as well. + +## Creating a template + +### Blog template + +Before you can even write anything you will have to add some templates into the `templates` directory (assuming your using the default). These templates are made using [Tera][1] reading the documentation should be enough to write a template for a blog post. +The values which mlem exposes to the blog template are: + +- `blog_content` This contains the HTML of the markdown of the post +- The values defined in the frontmatter + +### Index template + +The index template will be used to generate an index of all posts. **It must be named `index.html`**. The values exposed to this template are: + +- `blog_posts` An array of structs containing the posts. + - title + - human_date + - sort_date + - content + - output_file_name +- `truncate` [filter][2]; works like a call to String.truncate() + +//TODO + +[1]: https://keats.github.io/tera/docs/ +[2]: https://keats.github.io/tera/docs/#filters \ No newline at end of file