🚀
Stancy
  • Introduction
  • Issues
  • Changelog
  • Installation
  • Getting started
  • Basics
    • Content
    • PageData
    • Make Page Command
  • Advanced
    • Feed Atom/RSS
    • Sitemap
    • static export
  • Webserver
    • 🚧nginx
    • 🚧caddy
  • Services
    • GitHub Actions
    • 🚧GitHub Pages
    • Netlify
    • 🚧sitesauce
    • 🚧forestry
Powered by GitBook
On this page
  • Install package
  • Configure dependencies
  • spatie/sheets
  • spatie/laravel-feeds
  • spatie/laravel-export

Was this helpful?

Installation

PreviousChangelogNextGetting started

Last updated 4 years ago

Was this helpful?

Install package

Add the package in your composer.json by executing the command.

composer require astrotomic/stancy

Configure dependencies

spatie/sheets

Stancy uses as base - a sheet is the data file which is used to fill a page. By default sheets can be Markdown (with YAML frontmatter), JSON or YAML files. But you can define your own . To use sheets you have to which is a folder that contains your sheets. You can define as much collections as you want.

<?php

use Spatie\Sheets\ContentParsers\JsonParser;

return [
    'default_collection' => 'static',

    'collections' => [
        'static',
        'blog',
        'data' => [
            'content_parser' => JsonParser::class,
            'extension' => 'json',
        ],
    ],
];
<?php

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

spatie/laravel-feeds

<?php

use Astrotomic\Stancy\Contracts\FeedFactory;

return [
    'feeds' => [
        'blog' => [
            'items' => [FeedFactory::class.'@makeFromSheetCollectionName', 'blog'],
            'url' => 'feed/blog.atom',
            'title' => 'Stancy Blog Feed',
            'description' => 'This is the Stancy blog feed.',
            'language' => 'en-US',
            'view' => 'feed::atom',
            'type' => 'application/atom+xml',
        ],
    ],
];

spatie/laravel-export

Stancy comes with feed (Atom & RSS) support which is provided by . A feed is generated from a sheet collection. Below is an example feed configuration which uses the \Astrotomic\Stancy\Contracts\FeedFactory.

Stancy integrates to generate static files. You can configure the exporter in the config file or use the \Astrotomic\Stancy\Contracts\ExportFactory to add your pages programmatically. We recommend to disable the crawl option in the config/export.php and use the export factory to add pages to your export list.

spatie/sheets
content parsers
create a collection
Content
spatie/laravel-feeds
Feed Atom/RSS
spatie/laravel-export
static export