Tag: About Magnet (12 posts)

Custom Pages

However markdown may be too restrictive — 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]

These pages are not posts, they don’t end up in the blogroll or the archive, they are indepedent and you’ll have to call them out in your templates.

Archive And Blogroll

The markdown for this post lives in the “more-posts” directory. If the “posts.yaml” file there is changed to say

skip-archive: true

when you click on the archive link, you’ll see the other posts there but not this one.

Likewise, setting

skip-blog-roll: true

in “more-posts/posts.yaml” would exclude any post in that directory from the blogroll, for instance.

page 3 of 3 « previous