pschmitt / phile-tags
Tags for Phile CMS
Fund package maintenance!
pschmitt
www.paypal.com/paypalme/pppschmitt
Installs: 8
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 3
Forks: 2
Open Issues: 2
Type:phile-plugin
Requires
- phile-cms/phile: >=1.0
- phile-cms/plugin-installer-plugin: >=1.0
This package is not auto-updated.
Last update: 2024-11-19 10:03:03 UTC
README
Plugin adds page tagging functionality to Phile. Based on Pico Tags by Szymon Kaliski, but only uses the provided hooks and leaves the Phile core alone.
It gives you access to:
- If on a
/tag/
URL, thecurrent_tag
variable - For every page,
page.meta.tags_array
--- array of tags for thepage
Installation
- Clone this repo to the
plugins/pschmitt/tags
:
mkdir -p ~http/plugins/pschmitt git clone https://github.com/pschmitt/phileTags.git ~http/plugins/pschmitt/tags # You may consider using a submodule for this git submodule add http://github.com/pschmitt/phileTags.git /srv/http/plugins/pschmitt/tags
- Important: Make a new template called
tag
(i.e.phile/themes/<your_theme>/tag.html
) which will be used when requesting atag/
URI.
- Activate it in
config.php
:
$config['plugins'] = array( // [...] 'pschmitt\\tags' => array('active' => true), );
Usage
Add a new Tags
attribute to the page meta:
/*
Title: My First Blog Post
Description: It's a blog post about javascript and php
Author: Dan Reeves
Robots: index,follow
Date: 2014/04/04
Tags: js, javascript, php
*/
Configuration
In config.php
you can customize:
-
$config['tag_template']
- which template should be used when on atag/
page. This setting defaults to'tag'
. -
$config['tag_separator']
- the separator used for splitting the tag meta(regexps, like'\s*'
are allowed). Its default value is','
.
Templates
You can now access both the current page meta.tags_array
and each page.meta.tags_array
in the pages
array:
tag.html
template may look like:
<!DOCTYPE html> <head> <title>{{ meta.title }}</title> </head> <body> <h2>Posts tagged #{{ current_tag }}:</h2> {% for page in pages %} {% if page.meta.tags_array and current_tag in page.meta.tags_array %} <div class="post"> <h2><a href="{{ base_url }}/{{ page.url }}">{{ page.meta.title }}</a></h2> <div class="excerpt">{{ page.content }}</div> <span class="meta-tags">Tags: {% for tag in page.meta.tags_array %} <a href="{{ base_url }}/tag/{{ tag }}">#{{ tag }}</a> {% endfor %} </span> </div> <!-- // post --> {% endif %} {% endfor %} </body> </html>
License
MIT