-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'remotes/origin/master' into ft-make-com…
…mand
- Loading branch information
Showing
47 changed files
with
976 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ | |
/.phpunit.result.cache | ||
/build/ | ||
/phpunit.xml | ||
/tests/export/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,12 @@ | ||
# Introduction | ||
|
||
![Stancy](.gitbook/assets/stancy_github_social.png) | ||
![Stancy](.gitbook/assets/banner%20%282%29.png) | ||
|
||
[![TravisCI](https://img.shields.io/travis/Astrotomic/stancy/master?label=TravisCI&style=flat-square&cacheSeconds=600)](https://travis-ci.org/Astrotomic/stancy/branches) | ||
[![StyleCI](https://styleci.io/repos/210212315/shield)](https://styleci.io/repos/210212315) | ||
[![ScrutinizerCI](https://img.shields.io/scrutinizer/build/g/Astrotomic/stancy?label=ScrutinizerCI&style=flat-square&cacheSeconds=600)](https://scrutinizer-ci.com/g/Astrotomic/stancy) | ||
[![Quality)](https://img.shields.io/scrutinizer/quality/g/Astrotomic/stancy?label=Quality&style=flat-square&cacheSeconds=600)](https://scrutinizer-ci.com/g/Astrotomic/stancy) | ||
[![Coveralls](https://img.shields.io/coveralls/github/Astrotomic/stancy?label=Coverage&style=flat-square&cacheSeconds=600)](https://coveralls.io/github/Astrotomic/stancy) | ||
[![Libraries.io](https://img.shields.io/librariesio/github/Astrotomic/stancy?label=Dependencies&style=flat-square&cacheSeconds=600)](https://libraries.io/packagist/astrotomic%2Fstancy) | ||
[![TravisCI](https://img.shields.io/travis/Astrotomic/stancy/master?label=TravisCI&style=flat-square)](https://travis-ci.org/Astrotomic/stancy/branches) [![StyleCI](https://styleci.io/repos/210212315/shield)](https://styleci.io/repos/210212315) [![ScrutinizerCI](https://img.shields.io/scrutinizer/build/g/Astrotomic/stancy?label=ScrutinizerCI&style=flat-square)](https://scrutinizer-ci.com/g/Astrotomic/stancy) [![Quality\)](https://img.shields.io/scrutinizer/quality/g/Astrotomic/stancy?label=Quality&style=flat-square)](https://scrutinizer-ci.com/g/Astrotomic/stancy) [![Coveralls](https://img.shields.io/coveralls/github/Astrotomic/stancy?label=Coverage&style=flat-square)](https://coveralls.io/github/Astrotomic/stancy) [![Libraries.io](https://img.shields.io/librariesio/github/Astrotomic/stancy?label=Dependencies&style=flat-square)](https://libraries.io/packagist/astrotomic%2Fstancy) | ||
|
||
[![PHP from Packagist](https://img.shields.io/packagist/php-v/astrotomic/stancy?label=PHP&style=flat-square)](https://packagist.org/packages/astrotomic/stancy) [![MIT License](https://img.shields.io/github/license/Astrotomic/stancy.svg?label=License&color=blue&style=flat-square)](https://github.com/Astrotomic/stancy/blob/master/LICENSE.md) [![Latest Version](http://img.shields.io/packagist/v/astrotomic/stancy.svg?label=Release&style=flat-square)](https://packagist.org/packages/astrotomic/stancy) [![Total Downloads](https://img.shields.io/packagist/dt/astrotomic/stancy.svg?label=Downloads&style=flat-square)](https://packagist.org/packages/astrotomic/stancy) [![GitHub contributors](https://img.shields.io/github/contributors/Astrotomic/stancy?label=Contributors&style=flat-square)](https://github.com/Astrotomic/stancy/graphs/contributors) [![Open Collective](https://img.shields.io/opencollective/all/astrotomic?label=Backers&style=flat-square)](https://opencollective.com/astrotomic) | ||
|
||
**You search for a CMS that only extends your loved Laravel/Lumen framework? Here it is.** | ||
|
||
This package aims to provide the most common \(and flexible\) CMS features to your Laravel/Lumen project. You can still use the frontend/template engine of your choice, use the scheduler/queue and receive POST requests. | ||
|
||
[![PHP from Packagist](https://img.shields.io/packagist/php-v/astrotomic/stancy?label=PHP&style=flat-square&cacheSeconds=600)](https://packagist.org/packages/astrotomic/stancy) | ||
[![MIT License](https://img.shields.io/github/license/Astrotomic/stancy.svg?label=License&color=blue&style=flat-square&cacheSeconds=600)](https://github.com/Astrotomic/stancy/blob/master/LICENSE.md) | ||
[![Latest Version](http://img.shields.io/packagist/v/astrotomic/stancy.svg?label=Release&style=flat-square&cacheSeconds=600)](https://packagist.org/packages/astrotomic/stancy) | ||
[![Total Downloads](https://img.shields.io/packagist/dt/astrotomic/stancy.svg?label=Downloads&style=flat-square&cacheSeconds=600)](https://packagist.org/packages/astrotomic/stancy) | ||
[![GitHub contributors](https://img.shields.io/github/contributors/Astrotomic/stancy?label=Contributors&style=flat-square)](https://github.com/Astrotomic/stancy/graphs/contributors) | ||
[![Open Collective](https://img.shields.io/opencollective/all/astrotomic?label=Backers&style=flat-square&cacheSeconds=600)](https://opencollective.com/astrotomic) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Feed Atom/RSS | ||
|
||
Stancy can generate feeds using [spatie/laravel-feed](https://github.com/spatie/laravel-feed). It allows you to generate a feed for a whole page collection. | ||
|
||
## Feed configuration | ||
|
||
The package provides a feed factory which enables you to generate your feed by passing the page collection name. | ||
|
||
{% code-tabs %} | ||
{% code-tabs-item title="config/feed.php" %} | ||
```php | ||
<?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', | ||
], | ||
], | ||
]; | ||
``` | ||
{% endcode-tabs-item %} | ||
{% endcode-tabs %} | ||
|
||
## Feed links | ||
|
||
You can generate alternate link tags for all your configured feeds and include them in your blade view. | ||
|
||
```text | ||
@include('feed::links') | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Sitemap | ||
|
||
Stancy can generate a sitemap using [spatie/laravel-sitemap](https://github.com/spatie/laravel-sitemap). It allows you to add whole collections but also single pages to a sitemap. | ||
|
||
## prepare Pages | ||
|
||
By default you can't add a page to your sitemap. You have to use a `\Astrotomic\Stancy\Models\PageData` class which defines the `toSitemapItem()` method. The easiest way is to use the `\Astrotomic\Stancy\Contracts\Routable` interface and `\Astrotomic\Stancy\Traits\PageHasUrl` trait. After this you only have to define the `getUrl()` method which is also useful to add the page to a [feed](feed.md) or generate a link to it in a view. | ||
|
||
{% code-tabs %} | ||
{% code-tabs-item title="app/Pages/Post.php" %} | ||
```php | ||
<?php | ||
|
||
namespace App\Pages; | ||
|
||
use Astrotomic\Stancy\Contracts\Routable; | ||
use Astrotomic\Stancy\Models\PageData; | ||
use Astrotomic\Stancy\Traits\PageHasContent; | ||
use Astrotomic\Stancy\Traits\PageHasSlug; | ||
use Astrotomic\Stancy\Traits\PageHasUrl; | ||
|
||
class Post extends PageData implements Routable | ||
{ | ||
use PageHasSlug, PageHasContent, PageHasUrl; | ||
|
||
public function getUrl(): string | ||
{ | ||
return route('blog.post', ['post' => $this->slug]); | ||
} | ||
} | ||
``` | ||
{% endcode-tabs-item %} | ||
{% endcode-tabs %} | ||
|
||
## Sitemap response | ||
|
||
The following code snippet will show you how to return a sitemap within your routes. The sitemap will contain all pages in the `static` and `blog` collection. | ||
|
||
{% code-tabs %} | ||
{% code-tabs-item title="routes/web.php" %} | ||
```php | ||
<?php | ||
|
||
use Astrotomic\Stancy\Facades\SitemapFactory; | ||
|
||
Route::get('/sitemap.xml', function () { | ||
return SitemapFactory::makeFromSheetList(['static', 'blog']); | ||
}); | ||
``` | ||
{% endcode-tabs-item %} | ||
{% endcode-tabs %} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
# static export | ||
|
||
Stancy integrates [spatie/laravel-export](https://github.com/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. | ||
|
||
{% 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. | ||
|
Oops, something went wrong.