Tags for Phile CMS

Installs: 2

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 2


1.0.0 2018-03-23 14:02 UTC

This package is auto-updated.

Last update: 2022-04-29 01:14:49 UTC


Build Status

Tag your pages. Show all pages with that tag.

A Phile plugin. Project home.


composer require siezi/phile-tags;


$config['plugins']['siezi\\phileTags'] = ['active' => true];


Add Tags to Pages

Add a new Tags attribute to the page meta:

Title: My First Blog Post
Tags: js, javascript, php

The tags are available as meta.tags_array in the template.

Shows Tags

To show tags for a page and link them to the tag-page:

{% if meta.tags_array is not empty %}
    {% for tag in meta.tags_array %}
        <a href="{{ base_url }}/tag/{{ tag }}">
            #{{ tag }}
    {% endfor %}
{% endif %}

Create Tag Page Template

Create a new template "tag.html" in themes/<your_theme>/tag.html. It is used to show all pages having a particular tag when calling the URL /tag/<tag-name>.

<!DOCTYPE html>
    <title>{{ meta.title }}</title>
    <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 %}

    {% endif %}
    {% endfor %}



See the config.php.