Skip to content

Commit

Permalink
GitBook: [master] 9 pages modified
Browse files Browse the repository at this point in the history
  • Loading branch information
Gummibeer authored and gitbook-bot committed Oct 15, 2019
1 parent 17cc35e commit 5031e99
Show file tree
Hide file tree
Showing 9 changed files with 110 additions and 9 deletions.
2 changes: 1 addition & 1 deletion docs/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
85 changes: 80 additions & 5 deletions docs/advanced/static-export.md
Original file line number Diff line number Diff line change
@@ -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
<?php

return [
// to only export listed paths/pages
'crawl' => 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
<?php

namespace App\Pages;

use Astrotomic\Stancy\Contracts\Routable;
use Astrotomic\Stancy\Models\PageData;

class Home extends PageData implements Routable
{
public function getUrl(): string
{
return url('/');
}
}
```
{% endcode-tabs-item %}
{% endcode-tabs %}

## 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.

{% code-tabs %}
{% code-tabs-item title="app/Providers/ExportServiceProvider.php" %}
```php
<?php

namespace App\Providers;

use Astrotomic\Stancy\Contracts\ExportFactory as ExportFactoryContract;
use Illuminate\Support\ServiceProvider;

class ExportServiceProvider extends ServiceProvider
{
public function boot(ExportFactoryContract $exportFactory)
{
$this->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.

6 changes: 3 additions & 3 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -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" %}

4 changes: 4 additions & 0 deletions docs/services/forestry.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
description: "\U0001F6A7 work in progress \U0001F6A7"
---

# 🚧 forestry

[https://forestry.io/](https://forestry.io/)
Expand Down
4 changes: 4 additions & 0 deletions docs/services/netlify.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
description: "\U0001F6A7 work in progress \U0001F6A7"
---

# 🚧 netlify

[https://www.netlify.com/](https://www.netlify.com/)
Expand Down
4 changes: 4 additions & 0 deletions docs/services/sitesauce.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
description: "\U0001F6A7 work in progress \U0001F6A7"
---

# 🚧 sitesauce

[https://sitesauce.app/](https://sitesauce.app/)
Expand Down
4 changes: 4 additions & 0 deletions docs/webserver/caddy.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
4 changes: 4 additions & 0 deletions docs/webserver/nginx.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down

0 comments on commit 5031e99

Please sign in to comment.