static export
Stancy integrates spatie/laravel-export to export your pages as static files.
Configuration
We recommend to disable the crawl
option and export only listed paths/pages. The paths
option can be empty if you only want to export feeds and/or pages. But you also can add additional paths, like the sitemap, to export.
prepare Pages
By default you can't export any page, only the feeds. To allow page export you have to implement the \Astrotomic\Stancy\Contracts\Routable
interface in your page data class. This interface is also good to add your pages to a sitemap and feeds.
ExportFactory
To add your pages programmatically you should use a service provider. This service provider should be the last or at least after \App\Providers\RouteServiceProvider
in your app.providers
configuration. In the service provider you should use the boot()
method where you can inject the \Astrotomic\Stancy\Contracts\ExportFactory
service and add a new booted
event listener.
This service provider will add all feeds, blog posts and the home
and blog
static pages.
Last updated