Getting started

Installation

composer require astrotomic/stancy
php artisan vendor:publish --provider="Spatie\Sheets\SheetsServiceProvider" --tag=config
mkdir -p ./resources/content/static
mkdir -p ./views/content
mkdir -p ./app/Pages
<?php

return [
    // ...
    'disks' => [
        // ...
        'static' => [
            'driver' => 'local',
            'root' => resource_path('content/static'),
        ],
    ],
];

This is everything you have to do to prepare your first static sheet/page collection.

Installation

Home

This will be an example for a simple static page - like your home/front page.

These three files will represent your home page. The markdown file will hold the data/content, the view will render it and the PHP class will validate it and provide additional features.

Now you have to add the route to your routes/web.php

Content

Sitemap

To add your page to the sitemap and return it if someone access /sitemap.xml you have to do the following.

This will add all pages in the static collection to your sitemap.

Sitemap

Blog

One of the most common examples for a page collection is a blog. You need an index page and a detail one for every article.

Before you can test this we will have to add our first post to the blog collection.

Now you are done. If you want to add a new post just add a new markdown file to the blog collection and fill all required data.

Feed

After you now have your first collection of same type pages (blog) it's useful to put them in a feed and link it in your HTML.

Now you have to prepare the \App\Pages\Post page data class.

And you are done. You will have two feeds (RSS and Atom) now. If you only want one just remove the other one from the config.

Feed Atom/RSS

Congratulations! πŸŽ‰ You have your first Stancy setup and are ready to go. πŸš€

Last updated

Was this helpful?