Front Matter

Front matter optionally starts your file. It contains instructions for things Markdown can't do for you, for example, choosing a theme, inserting Javascript or new style tags into your document, and ensuring each page can have a unique <title> tag.

It is technically a different document from your Markdown article, and it's in a format called YAML.

Here's an example of a page with a title defined in the front matter.

---
title: Who doesn't love static site generators?
---
# My life is now perfect

Thanks to exercise, diet, and mostly, PocoCMS.

This page gives you a somewhat technical overview of front matter, then explains all the front matter options PocoCMS provides.

Formatting rules
Front matter basics

Alphabetical list of front matter options

aside
author
burger
description
footer
header
hide
keywords
lang
nav
pagetheme
robots
sidebar
skip
styles
stylesheets
theme
title

Return to top

Front Matter basics

The simplest PocoCMS Markdown document looks something like this:

hello, world.

It generates the following HTML document:

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>Powered by PocoCMS</title>
</header>
	<article id="article-poco">
  <p>hello, world.</p>
	</article>
</div><!-- content-wrap -->
	</div><!-- page-container -->
</body>
</html>

You will normally see a more complex structure, with nonprinting commands that start the file:

---
title: "Introducing PocoCMS"
keywords: "static site generator, jamstack, cms"
---
hello, world. 

The text between the two --- lines is considered a separate document with no direct relation to the remainder of the file, which is the Markdown portion. It's called front matter by convention, but what lies between the bracketing --- characters is essentially a database in YAML format. This data is used to control the format and output of the HTML files PocoCMS produces.

Here's what happens when PocoCMS generates HTML for the previous example:

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>Introducing PocoCMS</title>
  <meta name="keywords" content="static site generator, jamstack, cms">
</header>
	<article id="article-poco">
  <p>hello, world.</p>
	</article>
</div><!-- content-wrap -->
	</div><!-- page-container -->
</body>
</html>

In the first example PocoCMS inserted this shamelessly self-promoting <title> tag:

<title>Powered by PocoCMS</title>

That's because an HTML file is not considered valid without a title. As you've already surmised, this portion of the front matter

---
title: "Introducing PocoCMS"
---

Is responsible for this line of HTML:

<title>Introducing PocoCMS</title>

And obviously this line of front matter

---
keywords: static site generator, jamstack, cms
---

Caused a keywords metatag to be inserted into the file:

<meta name="keywords" content="static site generator, jamstack, cms">

Return to top

Formatting rules

---
title: PocoCMS makes cry out with joy
---

This will not:

---
Title: I'm totally invisible
---
---
---

aside

Asides appear next to the article content: Anatomy.

When given a filename, use the contents of that file instead of the value supplied by the theme.

---
aside: new-aside.md
---
Filename: new-aside.md
Announcement soon. Check the [news](news.html) page tomorrow!

HTML aside file

You can also use an HTML file. If so, remember to start with an HTML <aside> tag end end with a </aside>. The file extension must be .html.

Filename: aside.html
<aside style="font-size:2em;font-weight:900;padding:0;margin:0;padding-bottom:2em;margin-top:4em;width:auto;-webkit-transform: rotateZ(-90deg);-ms-transform: rotateZ(-90deg);transform: rotateZ(-90deg);">WHAT'S UP?</aside>

Theme README.md vs. individual page

If you put this in the front matter of the theme README.md file, it will be used on every page of the site by default. If you put it in the front matter of an individual page, it will only affect that page.

See also header, nav, and footer

Return to top

author

Causes an author metatag to be inserted into the file.

Example

Using this Author declaration in the front matter:

---
author: "Tom Campbell"
---

Causes this metatag to be generated:

<meta name="author" content="Tom Campbell">

Return to top

burger

Defines the list of links used for the burger menu, a fallback menu meant to appears only in small screen formats. It's part of the theme README and is used an alternate to the header, which is often too large for a phone.

Its contents should only be in the form of a Markdown unordered list, like so:

- [Home](https://pococms.com)
- [Github](https://github.com/pococms/poco)
- [Demos](https://pococms.com/docs/theme-demos.html)

You can change what the burger menu icon (indicator) looks like. See burgericon.

Return to top

burgericon

Character or word representing the burger menu.

description

Causes a description metatag to be inserted into the file.

Example

Using this Description in the front matter:

---
description: "PocoCMS is the easiest static site generator available"
---

Causes this metatag to be generated:

<meta name="description" content="PocoCMS is the easiest static site generator available">

Return to top

Controls behavior of the footer, shown in Anatomy.

When given a filename, uses the contents of that file instead of the value supplied by the theme.

Filename: new-footer.md
---
footer: new-footer.md
---
Powered by PocoCMS!

You can also use an HTML file. If so, remember to start with an HTML <footer> tag end end with a </footer>. The file extension must be .html.

Filename: footer.html
<footer>Prices so good it looks like a <span style="padding:0 1em 0 1em;font-size:2rem;color:yellow;background-color:black;font-family:monospace">CRIME SCENE!</footer>

Theme README.md vs. individual page

If you put this in the front matter of the theme README.md file, it will be used on every page of the site by default. If you put it in the front matter of an individual page, it will only affect that page.

Return to top

Controls behavior of the header, shown in Anatomy.

When given a filename, uses the contents of that file instead of the value supplied by the theme.

---
header: new-header.md
---
Filename: new-header.md
Powered by PocoCMS!

HTML header file

You can also use an HTML file. If so, remember to start with an HTML <header> tag end end with a </header>. The file extension must be .html.

Filename: header.html
<header style="font-size:3em;font-weight:900;background: #FF0000;background: linear-gradient(to left, #FF0000 76%, #ffff00 6%, #FF0000 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent;">FIRE!</header>

Theme README.md vs. individual page

If you put this in the front matter of the theme README.md file, it will be used on every page of the site by default. If you put it in the front matter of an individual page, it will only affect that page.

Return to top

hide

Suppresses the header, nav, article, aside, or footer, shown in Anatomy.

To hide the aside and the footer, for example:

---
hide: aside, footer
---
Filename: new-header.md
Powered by PocoCMS!

Return to top

keywords

Takes a list of keywords to be used in the keywords metatag.

Example

---
keywords: static site generator, jamstack, cms
---

Generates this keywords metatag to be inserted into the file:

<meta name="keywords" content="static site generator, jamstack, cms">

Return to top

lang

Sets the code HTML uses for its html lang= tag. Defaults to en for English.

Example

---
lang: "is"
---
<html lang="en">

Return to top

Controls behavior of the navbar, shown in Anatomy.

When given a filename, uses the contents of that file instead of the value supplied by the theme.

---
nav: new-navbar.md
---
Filename: new-navbar.md
Announcement soon. Check the [news](news.html) page tomorrow!

See also header, aside, and footer

HTML nav file

You can also use an HTML file. If so, remember to start with an HTML <nav> tag end end with a </nav>. The file extension must be .html.

Filename: nav.html

<nav style="text-shadow: 0 0 30px white;line-height:2em;font-weight:900;font-size:2em;color:white;background:#1F6097;text-align:center;">FOGGY</nav>

Theme README.md vs. individual page

If you put this in the front matter of the theme README.md file, it will be used on every page of the site by default. If you put it in the front matter of an individual page, it will only affect that page.

Return to top

header

Return to top

pagetheme

Defines a page theme to replace the global theme if any, on a per-page basis.

---
pagetheme: hero
---

Return to top

robots

Causes a robots metatag to be inserted into the file.

Example

Using this Robots entry in the front matter:

---
robots: "NoIndex"
---

Causes this metatag to be generated:

<meta name="robots" content="noindex">

NOTE

Be careful following this example! It tells search engines not to index your page, which is the opposite of what you normally want.

Return to top

An aside can often be on either the left or the right side of the page. That capability is built into the PocoCMS theme framework.

sidebar lets you choose which side it's on in the obvious way:

---
sidebar: left
---

The options are right or left. The theme will fail silently
if it doesn't support sidebar.

skip

skip lists files and directories you don't want to be published.

Remember that if a directory contains the files index.md, installation.md, and avatar.png, and 401K-info.xls, here's what will happen when you run PocoCMS:

Example

---
skip:
- 401k-info.xls
- node_modules
- www
- .git
- .DS_Store
- .gitignore
---

Here are some common items to skip:

---
skip-publish:
- node_modules
- htdocs
- public_html
- www
- .git
- .DS_Store
- .gitignore
---

Return to top

stylesheets

Causes a stylesheet link to be inserted into the file for each file in the list.

Example

Using these stylesheets in the front matter:

---
stylesheets: 
- "../../css/layout.css"
- "https://cdn.jsdelivr.net/npm/@ajusa/lit@latest/src/lit.css"
---

Return to top

styles

Causes a <style> tag to be inserted into the file for each line in the list. Because they are inserted after Stylesheets they override whatever appears in the stylesheets for the current page. It's a good way to develop stylesheets slowly, or to override colors for a light them to make it dark, and vice versa.

Example

Using this styles entry in the front matter to color all your article text blue:

---
styles: 
- "article>p{color:blue;}"
---

HTML generated:

<style>
  article>p{color:blue;}
</style>

Return to top

theme

Defines a theme to be used as the default for all pages in the site. It's also called the global theme informally. It is optional but can only appear on the home page. The global theme can be overridden on a per-page basis using pagetheme.

---
theme: pocodocs
---

Global theme on every page but the home page

Suppose you want to use the same theme on every page but the home page. Take advantage of the way the home

Filename: index.md
---
theme: pocodocs
pagetheme: hero
---

Putting both of these on the home page is perfectly logical. The theme rule causes that theme to be used on every page in the site without your specifying it. The pagetheme rule causes the theme to be overridden for the selected page... which in this case is the home page.

This works only on the home page.

Return to top

title

The title key lets you set a title for your HTML page. This has a number of important benefits.

Example:

---
title: "Static generator overview"
---

# Static Site Generators

This page would have its title metatag set to Static generator overview.

Return to top