diff --git a/docs/SUMMARY.md b/docs/SUMMARY.md index 5a85435..14c695a 100644 --- a/docs/SUMMARY.md +++ b/docs/SUMMARY.md @@ -15,7 +15,7 @@ * [Feed Atom/RSS](advanced/feed.md) * [Sitemap](advanced/sitemap.md) -* [🚧 static export](advanced/static-export.md) +* [static export](advanced/static-export.md) ## Webserver diff --git a/docs/advanced/static-export.md b/docs/advanced/static-export.md index b66739b..003ca00 100644 --- a/docs/advanced/static-export.md +++ b/docs/advanced/static-export.md @@ -1,8 +1,83 @@ ---- -description: "\U0001F6A7 work in progress \U0001F6A7" ---- +# static export -# 🚧 static export +Stancy integrates [spatie/laravel-export](https://github.com/spatie/laravel-export) to export your pages as static files. -[https://github.com/Astrotomic/stancy/issues/20](https://github.com/Astrotomic/stancy/issues/20) +## 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. + +{% code-tabs %} +{% code-tabs-item title="config/export.php" %} +```php + false, + + 'paths' => [ + '/sitemap.xml', + ], +]; +``` +{% endcode-tabs-item %} +{% endcode-tabs %} + +## 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](../basics/pagedata.md). This interface is also good to add your pages to a [sitemap](sitemap.md) and [feeds](feed.md). + +{% code-tabs %} +{% code-tabs-item title="app/Pages/Home.php" %} +```php +app->booted(function () use ($exportFactory) { + $exportFactory + ->addFeeds() + ->addSheetList(['static:home', 'static:blog']) + ->addSheetCollectionName('blog') + ; + }); + } +} +``` +{% endcode-tabs-item %} +{% endcode-tabs %} + +This service provider will add all [feeds](feed.md), blog posts and the `home` and `blog` static pages. diff --git a/docs/changelog.md b/docs/changelog.md index 076d182..04e160b 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -7,9 +7,9 @@ All notable changes to this package will be documented in this file. The format ### Added * ExportFactory which integrates spatie/laravel-export - * `\Astrotomic\Stancy\Contracts\ExportFactory` - * `\Astrotomic\Stancy\Facades\ExportFactory` - * `\Astrotomic\Stancy\Factories\ExportFactory` + * `\Astrotomic\Stancy\Contracts\ExportFactory` + * `\Astrotomic\Stancy\Facades\ExportFactory` + * `\Astrotomic\Stancy\Factories\ExportFactory` * `\Astrotomic\Stancy\Models\Page::getUrl()` method which depends on `\Astrotomic\Stancy\Contracts\Routable` interface ## [v0.3.0](https://github.com/Astrotomic/stancy/releases/tag/0.3.0) - 2019-10-14 diff --git a/docs/installation.md b/docs/installation.md index 08bbd84..c4d239e 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -46,3 +46,9 @@ return [ {% page-ref page="advanced/feed.md" %} +### spatie/laravel-export + +Stancy integrates [spatie/laravel-export](https://github.com/spatie/laravel-export) 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. + +{% page-ref page="advanced/static-export.md" %} + diff --git a/docs/services/forestry.md b/docs/services/forestry.md index 8eab0d1..f2efd03 100644 --- a/docs/services/forestry.md +++ b/docs/services/forestry.md @@ -1,3 +1,7 @@ +--- +description: "\U0001F6A7 work in progress \U0001F6A7" +--- + # 🚧 forestry [https://forestry.io/](https://forestry.io/) diff --git a/docs/services/netlify.md b/docs/services/netlify.md index 76ca6e6..14d0cc5 100644 --- a/docs/services/netlify.md +++ b/docs/services/netlify.md @@ -1,3 +1,7 @@ +--- +description: "\U0001F6A7 work in progress \U0001F6A7" +--- + # 🚧 netlify [https://www.netlify.com/](https://www.netlify.com/) diff --git a/docs/services/sitesauce.md b/docs/services/sitesauce.md index 876112b..854c701 100644 --- a/docs/services/sitesauce.md +++ b/docs/services/sitesauce.md @@ -1,3 +1,7 @@ +--- +description: "\U0001F6A7 work in progress \U0001F6A7" +--- + # 🚧 sitesauce [https://sitesauce.app/](https://sitesauce.app/) diff --git a/docs/webserver/caddy.md b/docs/webserver/caddy.md index d58bcff..fae4164 100644 --- a/docs/webserver/caddy.md +++ b/docs/webserver/caddy.md @@ -1,3 +1,7 @@ +--- +description: "\U0001F6A7 work in progress \U0001F6A7" +--- + # 🚧 caddy [https://github.com/Astrotomic/stancy/issues/30](https://github.com/Astrotomic/stancy/issues/30) diff --git a/docs/webserver/nginx.md b/docs/webserver/nginx.md index b767873..ce59cd1 100644 --- a/docs/webserver/nginx.md +++ b/docs/webserver/nginx.md @@ -1,3 +1,7 @@ +--- +description: "\U0001F6A7 work in progress \U0001F6A7" +--- + # 🚧 nginx [https://github.com/Astrotomic/stancy/issues/21](https://github.com/Astrotomic/stancy/issues/21)