Magnet Docs v1.1.4 archive about feed docs

Author: Susan Essay

Monday, October 30, 2023 by Susan Essay tags: • posts

New Posts

Try adding a file named “newest.md” to the “posts” directory that looks like this:

---
title: "This Is The Newest Entry"
tags: test
---

This is a new entry in _Markdown_.

Stop and restart the “go-magnet show” command, you should see the new post at the top since there was no “Publish” set in the markdown. It uses the file creation date in that case. You can set “Publish” to whatever date you want as long as it fits the “Y-m-d H:m:s” format.

Sunday, October 29, 2023 by Susan Essay tags: • blog-twoposts

Removing A Post

If you want to remove a post then delete the markdown file and rerun the “go-magnet show” command or add:

live: false

to the metadata in the markdown of the entry you want to unpublish.

Friday, October 27, 2023 by Susan Essay tags: • posts

Tags And Authors

Metadata at the top of each Markdown post can include Tags and or an Author.

---
title: "More About Rocks"
publish: 2023-04-01 10:00:00
tags: rocks
author: "Susan Essay"
summary: "More than you ever wanted to know about rocks..."
---

Also, Tags and or an Author can be included in the Post Settings file:

---
name: "Susan's Posts"
archive: true
blogroll: true
author: "Susan Essay"
tags: geology

Tags for each post are amended — so if the post meta has tags “things, stuff” and the post settings has “geology” then the published post will have the tags “things, stuff, geology”.

Author in only a single value, so it is not amended but is set.

Wednesday, October 25, 2023 by Susan Essay tags: • posts

Post IDs & Custom IDs

You might want to use a custom URI for a posts:

---
title: "Using A Custom Post ID"
publish: 2023-12-16 12:13:13
id: thingstuff
tags: about-ids
summary: "Showing a custom ID..."
---

This will be served under:

http://127.0.0.1:8081/post/thingstuff/

where “thingstuff” is used instead of the filename of the post markdown. The filename of this post is “custom-id.md” (you can name posts whatever you want), so without the ID set in metadata the local url would look like:

http://127.0.0.1:8081/post/custom-id/

If there are more than one files named the same (across different post directories for instance) the ID will have a small random suffix added to prevent collision.

A good practice is to name files with two pieces of information, say, date and title. For instance:

20230330-custom-ids.md

Naming like this, consistently, means you’ll be able to easily glance over the file tree to see your posts and also likely avoid naming two files the same thing.

Monday, October 23, 2023 by Susan Essay tags: • settings

Custom Pages

Sometimes you may need a custom page instead of a post. See the “about” page. The file for “about” lives in the “templates” directory instead of one of the markdown directories. In Site Settings you’ll see “custompages: about”, which tells Magnet to look for an “about.html” file in templates. If you want to add a new custom page, add a name there and a “name.html” in “templates”. The content for the about page looks like:

{{define "content"}}

<h1>Some Custom page</h1>

<h2>Thing</h2>

This is a custom page. Some more text.

{{end}}

Custom pages are written in HTML, not markdown.

See the “define” part? That puts the content inside the layout template.

Create a new custom page — copy the “about.html” page and name it “contact.html”. Change the Site Settings “site.yaml” line from

custom-pages: about

to

custompages: about, contact