pschmitt/phile-tags
Composer 安装命令:
composer require pschmitt/phile-tags
包简介
Tags for Phile CMS
README 文档
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_tagvariable - 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
统计信息
- 总下载量: 8
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-01-10