-
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More content on example/demo site (#57)
- Loading branch information
1 parent
262c5cb
commit 07f434f
Showing
6 changed files
with
320 additions
and
12 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
206 changes: 206 additions & 0 deletions
206
example/content/2024-10-19-what-is-marmite-static-site-generator.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,206 @@ | ||
--- | ||
tags: markdown | ||
--- | ||
# What is marmite | ||
|
||
**Marmite** is a simple, easy and opinionated static site generator, | ||
probably the easiest and simple to use. | ||
|
||
**Marmite** is written in **Rust** so it is very fast and everything is included | ||
in a single binary. | ||
|
||
You can use it to generate a static blog, starting with the built-in **theme** | ||
and then fully customize if you want a more personalized website. | ||
|
||
To generate your static site the only thing you need is a folder with some | ||
markdown files and `marmite` | ||
|
||
assuming you have a folder called `mycontent` containing files with `.md` extension | ||
such as `about.md,first-post.md,second-post.md` | ||
|
||
```console | ||
$ marmite mycontent mysite | ||
|
||
Generated /mysite/about.html | ||
Generated /mysite/first-post.html | ||
Generated /mysite/second-post.html | ||
... | ||
|
||
Site generated at: /mysite | ||
``` | ||
|
||
That is all you need to have a blog like this generated: | ||
|
||
<details> | ||
<summary> <strong>CLICK HERE</strong> TO SEE SOME SCREENSHOTS </summary> | ||
|
||
The following screenshots are using the default embedded | ||
templates (from [/example](/~https://github.com/rochacbruno/marmite/blob/main/example) folder) | ||
|
||
**Light Mode** | ||
|
||
Index: | ||
|
||
 | ||
|
||
Content: | ||
|
||
 | ||
|
||
**Dark mode** | ||
|
||
Index: | ||
|
||
 | ||
|
||
Content: | ||
|
||
 | ||
|
||
</details> | ||
|
||
--- | ||
|
||
## Content Types | ||
|
||
Marmite separates content in two kinds, **posts** and **pages**. | ||
|
||
An **opinionated** decision of marmite is how it makes this distinction, | ||
|
||
### Post | ||
|
||
If content has a **date** it is a **Post** | ||
|
||
If the `file.md` has a **FrontMatter** (metadata on its first lines) defining a | ||
`date: YYYY-MM-DD` field, or the date field is extracted from the file name `YYYY-MM-DD-file.md` | ||
|
||
Posts are shown on `index.html` page sorted by date, and also shown on `tag/{tag}.html` page, | ||
and included on the `RSS` and `JSON` **feeds**. | ||
|
||
### Page | ||
|
||
If the markdown file does't define a date, then `marmite` can't list it on index or feeds, because | ||
it doesn't know where to include it in the chronological order, so it makes sense to render this content | ||
as a `{slug}.html` and make it accessible only via the link directly. | ||
|
||
## Menu | ||
|
||
By default marmite includes 3 items in the main menu: | ||
|
||
- Pages -> pages.html | ||
- List of posts in chronological order. | ||
- Tags -> tags.html | ||
- List of tags and a link to each tag group page. | ||
- Archive -> archive.html | ||
- List of YEAR and link to each year group page. | ||
|
||
|
||
Menu can be optionally customized in the configuration file, it is possible | ||
to add any **post**, **page** or external **link** to the menu. | ||
|
||
## Metadata | ||
|
||
On each markdown file it is possible to define metadata on the **FrontMatter**, | ||
the first lines of the file separated by `---`. | ||
|
||
```markdown | ||
--- | ||
field: value | ||
--- | ||
|
||
# title | ||
|
||
Content | ||
``` | ||
|
||
`marmite` supports 5 fields: | ||
|
||
- `title: This is the post title` | ||
- default: extracted from the first line of markdown. | ||
- `slug: this-is-the-post-slug` | ||
- default: title or filename slugified. | ||
- `date: YYYY-MM-DD` | ||
- default: extracted from filename or null. | ||
- `tags: tag1, tag2, tag3` | ||
- `extra: {}` | ||
- arbitrary extra key:value pair in YAML format (for template customization) | ||
|
||
## Media | ||
|
||
Images can be added using the normal markdown tag, marmite doesn't have shortcodes yet. | ||
|
||
For local images you have to put the files in a folder named `media` in the content folder. | ||
|
||
```markdown | ||
# content with media | ||
|
||
 | ||
``` | ||
|
||
Marmite will copy your `media` folder to the output site, it is recommended to use `./media` as | ||
the URL for relative media. | ||
|
||
## Site Config | ||
|
||
Optionally, a file named `marmite.yaml` inside your content folder (together with your .md files) | ||
can be used to customize configuration. | ||
|
||
> `--config file.yaml` can also be passed directly to the CLI. | ||
example: | ||
|
||
```yaml | ||
name: My Blog | ||
tagline: Poems, Essays and Articles | ||
url: https://mysite.com/blog | ||
menu: | ||
- ["About", "about.html"] | ||
- ["Projects", "projects.html"] | ||
- ["Contact", "contact.html"] | ||
- ["Github", "/~https://github.com/rochacbruno"] | ||
``` | ||
Other options are available and can be viewed on [repository](/~https://github.com/rochacbruno/marmite/blob/main/example/marmite.yaml) | ||
## Theme customization | ||
The embedded templates are created with [picocss.com](https://picocss.com/) and | ||
it is easy to customize, just put a `style.css` in the same folder where the markdown | ||
files are located and use anything that pico supports or just be creative with css. | ||
|
||
## Creating a new Theme | ||
|
||
To create a new theme is very simple, you just need to add to your content folder | ||
the `templates` and `static` directories and then customize in the way you like. | ||
|
||
To learn more about how to create a new theme check this post: | ||
|
||
[Customizing Templates](https://rochacbruno.github.io/marmite/customizing-templates.html) | ||
|
||
|
||
## Hosting | ||
|
||
The result is a static site, so you can host it in any web server, examples: | ||
|
||
- Github pages | ||
- Gitlab pages | ||
- Netlify | ||
- Vercel | ||
- Nginx | ||
- Apache | ||
|
||
|
||
## More features | ||
|
||
There are more to come, marmite will include soon support for the most simple and | ||
popular comment systems. | ||
|
||
Also, on of the goals is to integrate with **ActivityPub** via the JSON feed and | ||
**Hatsu**. | ||
|
||
If you have ideas please open issues on the repository. | ||
|
||
That's all! | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/* customize me */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters