From 86ab11073a263a960f591ccb1235ceb0c195d797 Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Sun, 24 Jun 2018 22:33:42 +0200 Subject: [PATCH] Add composer.json and update PicoExcerpt file and class docs --- PicoExcerpt.php | 33 ++++++++++++++++++++++++--------- README.md | 6 +++--- composer.json | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 59 insertions(+), 12 deletions(-) create mode 100644 composer.json diff --git a/PicoExcerpt.php b/PicoExcerpt.php index 00cae14..66f0df0 100644 --- a/PicoExcerpt.php +++ b/PicoExcerpt.php @@ -1,17 +1,32 @@ + * + * 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: + * + * + * + * 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 diff --git a/README.md b/README.md index 53f1a68..acc5f61 100644 --- a/README.md +++ b/README.md @@ -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. @@ -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+ @@ -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 diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..787b021 --- /dev/null +++ b/composer.json @@ -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" ] + } +}