Skip to content
This repository has been archived by the owner on Jan 25, 2021. It is now read-only.

Latest commit

 

History

History
60 lines (37 loc) · 1.85 KB

readme.md

File metadata and controls

60 lines (37 loc) · 1.85 KB

Read later plugin

This is a plugin for Kirby that let´s you save the page for later reading. It currently supports Instapaper and Pocket.

Installation

Put the readlater folder in /site/plugins.

How to use it

Simple! Put <?php echo readlater($page->title(),'instapaper') ?> in your template and it will echo the a link that let´s you save the page to Instapaper. Do you want to use Pocket? Then you use <?php echo readlater($page->title(),'pocket') ?> in your template.

You can pass any other page variable to use for the title. I assume that you use $page->title() for the title but you are free to change it. By default, the link references the URL of the current page but you can customize the target URL.

Example usage

<?php snippet('header') ?>
<?php snippet('menu') ?>
<?php snippet('submenu') ?>

<section class="content">

    <article>
        <?php echo readlater($page->title(),'pocket') ?>
        <h1><?php echo html($page->title()) ?></h1>
        <?php echo kirbytext($page->text()) ?>
    </article>

</section>

<?php snippet('footer') ?>

Link text

The plugin let's you change the link text with ease. The default format for Instapaper is Add to Instapaper. For Pocket we use Save to Pocket.

Simply pass the link text as third argument to use your own.

<?php echo readlater($page->title(), 'instapaper', 'Read later'); ?>

Options

You can add additional options to customize the html result:

<?php

echo readlater($page->title(), 'instapaper', 'Read later', array(
	'class'  => 'mycustomclass',
	'target' => '_blank',
	'rel'    => 'somerelattribute',
	'url'    => $page->url()
));

?>

Author

Author: Roy Lodder http://roylodder.com Contributor: Bastian Allgeier http://getkirby.com