Simple Website Framework

Page Layouts

Monday April 20th, 2026

Written by Scary le Poo

Every page file has a pagelayout field in its metadata block. This tells the framework which layout template to use when rendering your page — controlling things like whether your title is displayed automatically, and whether your content is treated as HTML or Markdown.

If you leave pagelayout blank, the framework defaults to page-html.


Available Layouts

The framework ships with four layouts out of the box:

Layout name Shows title? Content type
page-html Yes HTML
page-html-notitle No HTML
page-md Yes Markdown
page-md-notitle No Markdown

What "Shows title?" means

The layouts that show a title automatically render your pagetitle metadata value as a large <h1> heading above your content — you don't need to write the heading yourself. On article type pages, the date and author are also shown beneath the title automatically.

The -notitle variants skip this entirely and go straight to your content. Use these when you want full control over how the top of your page looks — for example, if you want a hero image, a custom styled heading, or no heading at all.


What "Content type" means

The HTML layouts render your page content exactly as written. What you put in the file is what appears on the page — so you write standard HTML tags like <p>, <h2>, <ul>, and so on.

The Markdown layouts pass your content through the Markdown parser first, converting it to HTML automatically. This is convenient for simpler text-heavy pages where you don't want to write tags by hand.

Both content types support shortcodes.


How to set a layout

Set the pagelayout field in your page's metadata block:

<!-- pagetitle: My Page -->
<!-- pagelayout: page-html -->
<!-- pagedate: -->
<!-- pageimage: -->
<!-- pageexcerpt: -->
<!-- pagekeywords: -->
<!-- pageauthor: -->
<!-- pagetype: -->

Change page-html to whichever layout you want. The name must match the filename of a layout file in your active theme folder, without the .php extension.


Creating your own layout

If the built-in layouts don't suit your needs, you can create your own. A layout file is just a PHP file that lives in your theme folder (e.g. themes/skeleton/). The framework will include whichever file matches the name you put in pagelayout.

The simplest way to start is to copy an existing layout and modify it. For example, to create a layout called page-landing:

  1. Copy themes/skeleton/page-html.php to themes/skeleton/page-landing.php
  2. Edit page-landing.php to change the HTML structure however you like
  3. Set <!-- pagelayout: page-landing --> in any page that should use it

Inside your layout file, the following PHP variables are available to use:

Variable Contains
$pagetitle The page title from metadata
$pagename The URL slug of the current page
$pagedate The publication date
$pageauthor The page author
$pagetype The page type (e.g. article, website)
$WebsiteTitle The site name from config

To render the page's content, read the file and echo it — exactly as the built-in layouts do:

<?php
    $filename = file_get_contents("./pages/" . $pagename . ".html");
    $parsed_content = parse_shortcodes($filename);
    echo $parsed_content; // for HTML content
    // or: echo from_markdown($parsed_content); // for Markdown content
?>

Your layout file will be included in the middle of the page — the theme's header.php runs before it, and footer.php runs after, so you don't need to worry about the navigation, the <head> block, or the footer.

Simple Website Framework

A lean, flat-file PHP framework with no database, no bloat, and no black boxes. Build something clean and keep control of every part of it.

Contribute on GitHub

Found a bug? Have an idea? The project is open source and contributions are welcome. Find it on GitHub.

Documentation

This site is the living documentation for the framework. Every feature is demonstrated in the place it's meant to be used. Start with the introduction or dive straight into the setup guide.