Magnet Docs v1.1.7 archive docs
tag → blog-one (6)

Hello

This is version 1.1.7 (2025-04)

See the changelog here.

What’s a static site generator?

Instead of work being done in an application on a remote server, like a CMS (WordPress for instance), work is done locally by Magnet to create the final set of HTML that you then put on a server or S3 or similar setup. Where you put the HTML is up to you.

What are the advantages?

Speed. Without an application or scripting language, the serving of flat HTML pages is faster than creating them on the server.

Security. There’s no application or database or admin endpoints needed on the server for the site, just plain HTML.

Why write in Markdown?

It’s simple, clean, helps removes distraction. If you write creatively it’s not going to get in your way. Markdown is plain text so you can use whatever editor you want. Basic Markdown syntax here.

Take a minute to read more. For settings reference and structure look at the docs here.

Your Site Settings

You’ll see a “site.yaml” file at the root of the magnet directory. See more about the site structure here.

You’ll also see “posts.yaml” files inside directories where posts live.

Try this, stop the “go-magnet show” command, open the “site.yaml” file and change the “pagesize: 5” line to “pagesize: 20”.

Restart go-magnet. You need to restart because this is a change that effects metadata and indices.

You’ll see that the number of posts shown on a single page has changed.

Page Layout

The page layout is a template that lives in the currently used theme. Open up “themes/propeller-2.0/templates/layout.html”. You should see some fairly basic HTML as well as some variables rendered by magnet. Note however, the “block content” section. This block is filled in by the “index.html” file, where the HTML for these posts lives. Changing the “layout.html” and “index.html” files lets you render the site very differently. A single theme is included here…

theme-name: propeller-2.0

…however you can easily copy and rename this directory to whatever you want, changing the html and css to what you like, then put that directory name into the site.yaml file. See more about site structure here.

Be sure to restart the magnet when you change this value.

Images

Including Local Images

Including images in a post is done in Markdown.

Take a look at the file “posts/images.md”, you’ll see that there are local images and remote images in the markdown. This one for instance:

Including Remote Images

You can include images from remote sources by using the remote url in the markdown. The image will be pulled down and placed into your images directory, and it should only do this once.

Since we can’t rely on the original name being well-formed or unique, the remote image gets renamed when it is saved. See which image extensions are the default here.

Images Index

An image index is created in the “indices” directory so that remote images are only pulled down once. If you need to re-pull images either edit or remove the “images.json” file in the “indices” directory.

Images Error Index

If there’s an error pulling down a remote image, information is left in the “images-err.json” file in indices. There’s a waiting period before the image can be retried, to be polite to remote servers, which is set here.

Basic HTML

Basic HTML should render properly.

Here’s a table:

cell one cell two

An H3, p tag:

Test

And this paragraph has a p tag with a css class.

Complex HTML alongside markdown may not render properly, so stick with markdown as much as you can.