Skip to content

Commit

Permalink
Add composer.json and update PicoExcerpt file and class docs
Browse files Browse the repository at this point in the history
  • Loading branch information
PhrozenByte committed Jun 24, 2018
1 parent a40befa commit 86ab110
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 12 deletions.
33 changes: 24 additions & 9 deletions PicoExcerpt.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,32 @@
<?php
/**
* This file is part of Pico. It's copyrighted by the contributors recorded
* in the version control history of the file, available from the following
* original location:
*
* <https://github.com/PhrozenByte/pico-excerpt/blob/master/PicoExcerpt.php>
*
* The file was previously part of the project's main repository; the version
* control history of the original file applies accordingly, available from
* the following original location:
*
* <https://github.com/picocms/Pico/blob/5cf47e65de66ffc963263a059eb5fe5defadd3e2/plugins/02-PicoExcerpt.php>
*
* SPDX-License-Identifier: MIT
* License-Filename: LICENSE
*/

/**
* Creates a excerpt for the contents of each page (as of Pico v0.9 and older)
* Creates a excerpt for the contents of each page
*
* This plugin exists for backward compatibility and is disabled by default.
* It gets automatically enabled when {@link PicoDeprecated} is enabled. You
* can avoid this by calling {@link PicoExcerpt::setEnabled()}.
* This plugin exists for historic reasons only and should not be used! It is
* disabled by default and needs to be enabled manually.
*
* This plugin doesn't do its job very well and depends on
* {@link PicoParsePagesContent}, what heavily impacts Pico's performance. You
* should either use the Description meta header field or write something own.
* Best solution seems to be a filter for twig, see e.g.
* {@link https://gist.github.com/james2doyle/6629712}.
* This plugin doesn't do its job very well and depends on Pico's official
* `PicoParsePagesContent` plugin, that heavily impacts Pico's performance. You
* should either use the `Description` meta header field or write a plugin on
* your own. Best solution for automatic excerpts seems to be a filter for
* Twig, see e.g. {@link https://gist.github.com/james2doyle/6629712}.
*
* @author Daniel Rudolf
* @link http://picocms.org
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Pico is a stupidly simple, blazing fast, flat file CMS. See http://picocms.org/

`PicoExcerpt` is a simple plugin that creates excperts of all your pages and makes them available using `{{ page.excerpt }}`. Installing this plugin is **highly discouraged**, because it depends on Pico's official [`PicoParsePagesContent` plugin][PicoParsePagesContent], that has a significant negative impact on your website's performance.

The main reason Pico started parsing the Markdown contents of all pages (see Pico's official [`PicoParsePagesContent` plugin][PicoParsePagesContent]), was the desire for automatically generated page excerpts. We later realized that this is the wrong approach and started searching for alternatives - and we think we found a better solution. We recommend to part from the concept of automatically generated excerpts. Instead, you should use the `Description` meta header to write excerpts on your own. Starting with Pico 1.0 you can use `%meta.*%` placeholders in your Markdown files, so you don't have to repeat yourself - simply add `%meta.description%` to the page content and Pico will replace it with your excerpt.
The main reason Pico started parsing the Markdown contents of all pages (see `PicoParsePagesContent`), was the desire for automatically generated page excerpts. We later realized that this is the wrong approach and started searching for alternatives - and we think we found a better solution. We recommend to part from the concept of automatically generated excerpts. Instead, you should use the `Description` meta header to write excerpts on your own. Starting with Pico 1.0 you can use `%meta.*%` placeholders in your Markdown files, so you don't have to repeat yourself - simply add `%meta.description%` to the page content and Pico will replace it with your excerpt.

By popular request we removed parsing the Markdown contents of all pages with Pico 1.0. This significantly improved Pico's performance. To preserve backwards compatibility (BC) we introduced the `PicoParsePagesContent` and `PicoExcerpt` plugins. Both plugins have been removed from Pico's default installation with Pico 2.0, but you can still install them manually.

Expand All @@ -18,7 +18,7 @@ Install

If you're using a `composer`-based installation of Pico (e.g. [`picocms/pico-composer`][PicoComposer]), simply open a shell on your server, navigate to Pico's install directory (e.g. `/var/www/html`) and run `composer require phrozenbyte/pico-excerpt` (via [Packagist.org][]). That's it!

If you're rather using one of [Pico's pre-built release packages][PicoRelease], you must first install the [`PicoParsePagesContent` plugin][PicoParsePagesContent]. After you've installed `PicoParsePagesContent`, create a empty `plugins/PicoExcerpt` directory in Pico's install directory (e.g. `/var/www/html`) on your server. Then download [`PicoExcerpt`'s latest source package][PicoPluginRelease] and upload all containing files (esp. `PicoExcerpt.php`) into said `plugins/PicoExcerpt` directory (resulting in `plugins/PicoExcerpt/PicoExcerpt.php`).
If you're rather using one of [Pico's pre-built release packages][PicoRelease], you must install the [`PicoParsePagesContent` plugin][PicoParsePagesContent] first. After you've installed `PicoParsePagesContent`, create a empty `plugins/PicoExcerpt` directory in Pico's install directory (e.g. `/var/www/html`) on your server. Then download [`PicoExcerpt`'s latest source package][PicoPluginRelease] and upload all containing files (esp. `PicoExcerpt.php`) into said `plugins/PicoExcerpt` directory (resulting in `plugins/PicoExcerpt/PicoExcerpt.php`).

`PicoExcerpt` requires Pico 1.0+

Expand All @@ -37,4 +37,4 @@ PicoExcerpt.enabled: true
[Packagist.org]: https://packagist.org/packages/phrozenbyte/pico-excerpt
[PicoRelease]: https://github.com/picocms/Pico/releases/latest
[PicoPluginRelease]: https://github.com/PhrozenByte/pico-excerpt/releases/latest
[PicoParsePagesContent]: https://github.com/PhrozenByte/pico-excerpt
[PicoParsePagesContent]: https://github.com/PhrozenByte/pico-parse-pages-content
32 changes: 32 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "phrozenbyte/pico-excerpt",
"type": "pico-plugin",
"abandoned": true,
"description": "This is Pico's official PicoExcerpt plugin. Pico is a stupidly simple, blazing fast, flat file CMS.",
"keywords": [ "pico", "picocms", "picocms-plugin", "pico-excerpt", "excerpts" ],
"homepage": "http://picocms.org/",
"license": "MIT",
"authors": [
{
"name": "The Pico Community",
"homepage": "http://picocms.org/"
},
{
"name": "Contributors",
"homepage": "https://github.com/picocms/pico-excerpt/graphs/contributors"
}
],
"support": {
"docs": "http://picocms.org/plugins/excerpt/",
"issues": "https://github.com/picocms/pico-excerpt/issues",
"source": "https://github.com/picocms/pico-excerpt"
},
"require": {
"php": ">=5.3.0",
"picocms/pico": "^1.0|^2.0",
"phrozenbyte/pico-parse-pages-content": "^1.0"
},
"autoload": {
"classmap": [ "PicoExcerpt.php" ]
}
}

0 comments on commit 86ab110

Please sign in to comment.