DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:tagging

Tagging Plugin

Compatible with DokuWiki

  • 2024-02-06 "Kaos" unknown
  • 2023-04-04 "Jack Jackrum" unknown
  • 2022-07-31 "Igor" unknown
  • 2020-07-29 "Hogfather" yes

plugin Allows users to annotate pages with tags, search for tags and show all tags one user has used

Last updated on
2023-09-27
Provides
Syntax, Helper, Action
Repository
Source
Requires
sqlite

Similar to labeled, tag

Tagged with annotations, cloud, tagcloud, tags

Needed for skilltagicon

A CosmoCode Plugin

Installation

:!: This plugin requires the following additional plugin that must be installed separately:

Search and install the plugin using the Extension Manager. Refer to Plugins on how to install plugins manually.

Several templates (like e.g., sprintdoc) support this plugin right out of the box.

In other cases after installation you need to add the component to display and edit a page's tags to your wiki. There are two ways.

Use in Sidebar

If your template supports a sidebar you can add the following syntax to its contents to display the tagging component:

{{tagging::input}}

Please note that this will disable caching for the sidebar page.

Embed in Template

Alternatively you can add the tagging component directly into your template's main.php:

<?php
    //show tagging only if user has access to page. Works on wikis with disabled acl too.
    if (auth_quickaclcheck(getID()) >= AUTH_READ ) {
        //check if sqlite plugin exists, tagging plugin requires it.
        if (!plugin_isdisabled('sqlite')) {
            //Tagging
            $tagging = plugin_load('helper','tagging');
            if ($tagging) {
                $tagging->tpl_tags();
            }
        }
    }
?>

Users of the dokuwiki template could also put above code in a newly created file conf/sidebarfooter.html.

Using with Vector Template

Users of the vector template could also put following to dokuwiki/lib/tpl/vector/user/boxes.php (NOT dokuwiki/lib/tpl/vector/conf/boxes.php):

//show tagging only if user has access to page. Works on wikis with disabled acl too.
if (auth_quickaclcheck(getID()) >= AUTH_READ ) {
    //check if sqlite plugin exists, tagging plugin requires it. if it doesn't exist or is disabled, vector template won't render
    if (!plugin_isdisabled('sqlite')) {
        $tagging = plugin_load('helper','tagging');
        if ($tagging) {
    	    $_vector_boxes["tagging"]["headline"] = "Tagging";
	    $_vector_boxes["tagging"]["xhtml"] = $tagging->tpl_tags(false);  //set $print to false
        }
    }
}

The first param of tpl_tags($print = true) is set to false to prevent direct printing.

Usage

Tags can be assigned to pages by any logged in user with write permissions for the page in question. Anonymous users can never tag pages, even if they have write permissions.

Once the code mentioned in the install section is inserted into your template, each page will show the current page's tags and allows to edit them. Each tag is linked to a search for that tag.

Single-User vs. Multi-User mode

By default the tag plugin will record tags separately for each user. Each user can add their own tag to a page. Users may only edit the tags they added themselves.

If you want all your users to maintain a single tag corpus, you can switch the plugin to 'single user mode' in the config. All tags will be saved under the username auto and can be edited by all users.

Embedding Clouds in Pages

A syntax component allows to embed tag clouds in pages. A tag cloud displays a list of tags where more often used tags are shown larger than less frequently used ones.

To list all tags used by pages in the current namespace (and below) use the following syntax:

{{tagging::ns}}

To specify a certain namespace (other than the current one) add it like this:

{{tagging::ns>NAMESPACE}}

To list all tags used by pages of whole wiki, independent of current namespace use the following syntax:

{{tagging::ns>*}}

To list all tags that were used by the currently logged in user use the following syntax:

{{tagging::user}}

To show the tags of a specific user, add the user name like this:

{{tagging::user>USERNAME}}

List Tagged Pages

List all pages tagged with a specific tag:

{{tagging::tag>TAGNAME}}

Hidden Tags

You can configure a prefix for tags that should not be shown to users who can't add tags themselves. By default it's set to the @ character.

Hidden Tags are useful as shortcuts to be used with the jump function below.

Jump to Tagged Page

It's possible to directly jump to a page tagged with a certain keyword using the URL http://yourwiki/doku.php?do=tagjmp&tag=mytag where mytag is the tag you used on that page.

You can also specify multiple tags to try using the Array syntax in the URL: http://yourwiki/doku.php?do=tagjmp&tag[]=mytag1&tag[]=mytag2&tag[]=mytag3. Each tag is tried until an existing one is found.

This is useful to assign shortcuts for pages and jump to them from external programs for example. When the content moves you can change the tag and don't need to adjust your external tool.

Please note: if you tagged multiple pages with the same tag, this functionality will simply jump to one of those pages.

When the translation plugin is installed, the language of each tagged page is recorded. You can then specify the language in the jump action: http://yourwiki/doku.php?do=tagjmp&tag=mytag&lang=en. If you just recently upgraded the tagging plugin, note that languages will only be recorded for newly added tags.

Tag Management

An admin page allows you to find, rename and delete tags.

In order to include tag management on regular pages to allow non-admin users to edit tags, use the syntax below:

{{tagging::manage}}

or if you want to limit the initial overview to a certain namespace:

{{tagging::manage>namespace}}

All ACL rules are respected, so non-admin users will not be able to view or modify tags if they do not have sufficient privileges for the tagged page.

The plugin integrates with regular search and elasticsearch. Use the syntax #sometag in addition to, or as a standalone search term.

The advanced search tools contain a tag filter. If any of the found pages are tagged, a dropdown list of available tags will let you narrow down the results.

Development

Change Log

Releases:

Known Bugs and Issues

Please report bugs and issues at: https://github.com/cosmocode/tagging/issues

plugin/tagging.txt · Last modified: 2024-04-30 16:51 by zweihorn

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki