|
| 1 | +--- |
| 2 | +tags: markdown |
| 3 | +--- |
| 4 | +# What is marmite |
| 5 | + |
| 6 | +**Marmite** is a simple, easy and opinionated static site generator, |
| 7 | +probably the easiest and simple to use. |
| 8 | + |
| 9 | +**Marmite** is written in **Rust** so it is very fast and everything is included |
| 10 | +in a single binary. |
| 11 | + |
| 12 | +You can use it to generate a static blog, starting with the built-in **theme** |
| 13 | +and then fully customize if you want a more personalized website. |
| 14 | + |
| 15 | +To generate your static site the only thing you need is a folder with some |
| 16 | +markdown files and `marmite` |
| 17 | + |
| 18 | +assuming you have a folder called `mycontent` containing files with `.md` extension |
| 19 | +such as `about.md,first-post.md,second-post.md` |
| 20 | + |
| 21 | +```console |
| 22 | +$ marmite mycontent mysite |
| 23 | + |
| 24 | +Generated /mysite/about.html |
| 25 | +Generated /mysite/first-post.html |
| 26 | +Generated /mysite/second-post.html |
| 27 | +... |
| 28 | + |
| 29 | +Site generated at: /mysite |
| 30 | +``` |
| 31 | + |
| 32 | +That is all you need to have a blog like this generated: |
| 33 | + |
| 34 | +<details> |
| 35 | +<summary> <strong>CLICK HERE</strong> TO SEE SOME SCREENSHOTS </summary> |
| 36 | + |
| 37 | +The following screenshots are using the default embedded |
| 38 | +templates (from [/example](https://github.com/rochacbruno/marmite/blob/main/example) folder) |
| 39 | + |
| 40 | +**Light Mode** |
| 41 | + |
| 42 | +Index: |
| 43 | + |
| 44 | + |
| 45 | + |
| 46 | +Content: |
| 47 | + |
| 48 | + |
| 49 | + |
| 50 | +**Dark mode** |
| 51 | + |
| 52 | +Index: |
| 53 | + |
| 54 | + |
| 55 | + |
| 56 | +Content: |
| 57 | + |
| 58 | + |
| 59 | + |
| 60 | +</details> |
| 61 | + |
| 62 | +--- |
| 63 | + |
| 64 | +## Content Types |
| 65 | + |
| 66 | +Marmite separates content in two kinds, **posts** and **pages**. |
| 67 | + |
| 68 | +An **opinionated** decision of marmite is how it makes this distinction, |
| 69 | + |
| 70 | +### Post |
| 71 | + |
| 72 | +If content has a **date** it is a **Post** |
| 73 | + |
| 74 | +If the `file.md` has a **FrontMatter** (metadata on its first lines) defining a |
| 75 | +`date: YYYY-MM-DD` field, or the date field is extracted from the file name `YYYY-MM-DD-file.md` |
| 76 | + |
| 77 | +Posts are shown on `index.html` page sorted by date, and also shown on `tag/{tag}.html` page, |
| 78 | +and included on the `RSS` and `JSON` **feeds**. |
| 79 | + |
| 80 | +### Page |
| 81 | + |
| 82 | +If the markdown file does't define a date, then `marmite` can't list it on index or feeds, because |
| 83 | +it doesn't know where to include it in the chronological order, so it makes sense to render this content |
| 84 | +as a `{slug}.html` and make it accessible only via the link directly. |
| 85 | + |
| 86 | +## Menu |
| 87 | + |
| 88 | +By default marmite includes 3 items in the main menu: |
| 89 | + |
| 90 | +- Pages -> pages.html |
| 91 | + - List of posts in chronological order. |
| 92 | +- Tags -> tags.html |
| 93 | + - List of tags and a link to each tag group page. |
| 94 | +- Archive -> archive.html |
| 95 | + - List of YEAR and link to each year group page. |
| 96 | + |
| 97 | + |
| 98 | +Menu can be optionally customized in the configuration file, it is possible |
| 99 | +to add any **post**, **page** or external **link** to the menu. |
| 100 | + |
| 101 | +## Metadata |
| 102 | + |
| 103 | +On each markdown file it is possible to define metadata on the **FrontMatter**, |
| 104 | +the first lines of the file separated by `---`. |
| 105 | + |
| 106 | +```markdown |
| 107 | +--- |
| 108 | +field: value |
| 109 | +--- |
| 110 | + |
| 111 | +# title |
| 112 | + |
| 113 | +Content |
| 114 | +``` |
| 115 | + |
| 116 | +`marmite` supports 5 fields: |
| 117 | + |
| 118 | +- `title: This is the post title` |
| 119 | + - default: extracted from the first line of markdown. |
| 120 | +- `slug: this-is-the-post-slug` |
| 121 | + - default: title or filename slugified. |
| 122 | +- `date: YYYY-MM-DD` |
| 123 | + - default: extracted from filename or null. |
| 124 | +- `tags: tag1, tag2, tag3` |
| 125 | +- `extra: {}` |
| 126 | + - arbitrary extra key:value pair in YAML format (for template customization) |
| 127 | + |
| 128 | +## Media |
| 129 | + |
| 130 | +Images can be added using the normal markdown tag, marmite doesn't have shortcodes yet. |
| 131 | + |
| 132 | +For local images you have to put the files in a folder named `media` in the content folder. |
| 133 | + |
| 134 | +```markdown |
| 135 | +# content with media |
| 136 | + |
| 137 | + |
| 138 | +``` |
| 139 | + |
| 140 | +Marmite will copy your `media` folder to the output site, it is recommended to use `./media` as |
| 141 | +the URL for relative media. |
| 142 | + |
| 143 | +## Site Config |
| 144 | + |
| 145 | +Optionally, a file named `marmite.yaml` inside your content folder (together with your .md files) |
| 146 | +can be used to customize configuration. |
| 147 | + |
| 148 | +> `--config file.yaml` can also be passed directly to the CLI. |
| 149 | +
|
| 150 | +example: |
| 151 | + |
| 152 | +```yaml |
| 153 | +name: My Blog |
| 154 | +tagline: Poems, Essays and Articles |
| 155 | +url: https://mysite.com/blog |
| 156 | +menu: |
| 157 | + - ["About", "about.html"] |
| 158 | + - ["Projects", "projects.html"] |
| 159 | + - ["Contact", "contact.html"] |
| 160 | + - ["Github", "https://github.com/rochacbruno"] |
| 161 | +``` |
| 162 | +
|
| 163 | +Other options are available and can be viewed on [repository](https://github.com/rochacbruno/marmite/blob/main/example/marmite.yaml) |
| 164 | +
|
| 165 | +## Theme customization |
| 166 | +
|
| 167 | +The embedded templates are created with [picocss.com](https://picocss.com/) and |
| 168 | +it is easy to customize, just put a `style.css` in the same folder where the markdown |
| 169 | +files are located and use anything that pico supports or just be creative with css. |
| 170 | + |
| 171 | +## Creating a new Theme |
| 172 | + |
| 173 | +To create a new theme is very simple, you just need to add to your content folder |
| 174 | +the `templates` and `static` directories and then customize in the way you like. |
| 175 | + |
| 176 | +To learn more about how to create a new theme check this post: |
| 177 | + |
| 178 | +[Customizing Templates](https://rochacbruno.github.io/marmite/customizing-templates.html) |
| 179 | + |
| 180 | + |
| 181 | +## Hosting |
| 182 | + |
| 183 | +The result is a static site, so you can host it in any web server, examples: |
| 184 | + |
| 185 | +- Github pages |
| 186 | +- Gitlab pages |
| 187 | +- Netlify |
| 188 | +- Vercel |
| 189 | +- Nginx |
| 190 | +- Apache |
| 191 | + |
| 192 | + |
| 193 | +## More features |
| 194 | + |
| 195 | +There are more to come, marmite will include soon support for the most simple and |
| 196 | +popular comment systems. |
| 197 | + |
| 198 | +Also, on of the goals is to integrate with **ActivityPub** via the JSON feed and |
| 199 | +**Hatsu**. |
| 200 | + |
| 201 | +If you have ideas please open issues on the repository. |
| 202 | + |
| 203 | +That's all! |
| 204 | + |
| 205 | + |
| 206 | + |
0 commit comments