Skip to content

Very basic implementation of the Openheart protocol for Kirby

License

Notifications You must be signed in to change notification settings

joachimesque/kirby-openheart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kirby-openheart 💗

A very basic implementation of the Openheart protocol for Kirby.

You can check out a demo article on my blog: A small Openheart implementation for Kirby — Le carnet de Joachim

State of the plugin

This plugin was developed for my own personal use. It works on my website, so my goal is fullfilled.

It is now published under a permissive license so that you can do whatever you wish with it. Don’t hesitate to fork this repo, prepare and publish the plugin for Composer, I do not want the responsibility associated with that part.

(is there a “Make it better” license? whereby I leave the code open, with the explicit goal that you have to make it better before redistributing it? anyways, that’s the spirit under which it is shared.)

The license doesn’t apply to the vendor code that is distributed along with this plugin. The emoji-picker-element dependency is the work of Nathan Lawson, for which I am forever grateful. It is copied in this repository (in assets/js/vendor/) because it’s the easiest way I know to do include and distribute it.

Using

Download & extract the project and copy it into your site/plugins directory.

Install the p3k/emoji-detector PHP dependency with Composer. The command should look like:

composer require p3k/emoji-detector

options

You can specify which emoji reactions you won’t allow.

// config.php'joachimesque.openheart.disallow' => ['🖕','🖕🏻','🖕🏼','🖕🏽','🖕🏾','🖕🏿'],

blueprints

Add the Openheart tab for site-wide emoji leaderboards

# site.yml
tabs:
  site:
    
  openhearts: tabs/openheart
Screenshot image

Add the Openheart field for a page-specific list of Openheart emoji

# default.yml
sections:
  fields:
    type: fields
    fields:
      openheart: fields/openheart
Screenshot image

templates

Add a call for the scripts in your template:

<?php /* layout.php */ ?>
…
<html>
  <head>
  …
  <?php snippet('openheart-scripts') ?>
  </head>
  <body>
  …

Add the openheart snippet in your content page:

<?php /* article.php */ ?>
<main>
  <h1><?= $page->title() ?></h1>
  …
  <?php snippet('openheart') ?>
</main>

You can also include a list of all openheart emojis to be displayed in your pages list:

<?php /* articles_list.php */ ?>
<?php foreach($page->children() as $child): ?>
  <article>
    <h2><?= $child->title() ?></h2>
    …
    <?php snippet('all-openhearts', ['page' => $child]) ?>
  </article>
<?php endforeach ?>

Websites

About

Very basic implementation of the Openheart protocol for Kirby

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published