Templates in Staticus are handled by Laravels Blade engine. To learn how to use Blade templates you should refer to the Laravel Blade documentation.
Every page will have a $page
object injected into it that contains the information about the page defined in config.php
(e.g. $page->title
). A $page
object may have the following attributes:
path
- The path to the pagetitle
- The title of the pagefrontMatter
- An optional array of front matter data for the pageCollection entries contain the same data but also have the following attributes:
markdown
- The markdown content for the entryhtml
- The generated HTML for the entryEvery page will also have a $staticus
object injected into it that can be used to access helpful information.
// Get the current environment
$staticus->environment()
// Get config values
$staticus->config('siteTitle')
// Get content data
$staticus
->content('posts')
->collection()
->all();
Any data included in your config.php
will be globally available to all pages via $staticus->config()
.
// config.php
return [
'siteTitle' => 'Staticus',
// ...
];
// In pages
{{ $staticus->config('siteTitle') }}