Write post/page

Improve this page

Technically, there is no difference in Sasige whether you write a post, a page or something else. We call it simply a page.

Basics

You have the pages folder. All what you put in there will be converted to websites. The name of a metafile is the same name as the resulting website html file. You can name the file to whatever you want. You set the date, sorting, title, language, etc... in the metafile so everything can be completely independent from the filename.

Metafile = Page

See more on that in the metafile section.

A new page

The website is generated by just the files in the pages folder.

Copy an existing page, rename it and update the metafile. You can always take a reference from our sasige-docs repository which uses every available technique.

Drafts

Every page you create can be in draft. Draft simply means you remove the date of a page. A page without a date is a draft page and it will not be published to the output folder. So remove the line with $page->setDate(xxx); from the metafile.

Markdown / Html

You have the choice. You can use markdown to write your content. You can also use pure HTML to write your content.

For the experts: Content in metafile

If you need more power and flexibility while you create a page, you probably want the full features of PHP. This means you can create the website with the power of the PHP language.

$page->setContentByCallable(function (Page $page) {
    ?>
    My content
    <?
});

What are the benefits of that? Just to name a few: Control structures (Loops, Conditions, etc...), StringFunctions, dynamic content (see bellow), and many more...

Dynamic content

You maybe need something more dynamic as a normal static website generator can offer. With Sasige you have the power of PHP, a fully functional server scripting language. Let's just name a few examples what someone maybe need.

  • Calling an API/website during generation. Example: A GitHub project. Maybe you have a changelog in your repository but for some reason you want the changelog nicely formated in your website style. So you can just use file_get_contents(URL) to load the contents and than you can use it in your content. For sure, this case can also be done with javascript and on client side. But all what's not required by the client is a plus in usability.

  • Your page require some repeating rows. Let's say you want list of all days of a year in a list. Writing it manually will take too much time. So you just use a for loop from 1 to 365 and you're fine in seconds.