Version 39 (modified by Michael Renzmann, 12 years ago) (diff)

Remove the link to that mail. The example refers to an old version of the plugin and wouldn't work that way with 0.6 and later versions.

Note: Version 0.6 is a complete rewrite for Trac 0.11. This page documents that version. Refer to this page for information on older versions of the plugin.

A Tagging System for Trac

The TagsPlugin implements both a generic tagging engine, and frontends for the Wiki and ticket systems. An extra text entry box is added to the Wiki edit page for tagging Wiki pages, and ticket fields (you can configure which ones) are treated as tags for the ticket system.

The TagsPlugin was originally created by Muness Alrubaie but has since been completely rewritten by Alec Thomas.

See also: KeywordSuggestPlugin

Bugs/Feature Requests

Check the existing bugs and feature requests. If you have additional issues, create a new ticket.

Installing TagsPlugin

  1. install
    • By hand:
      1. Download tags: [download:tagsplugin/tags/0.6] or grab the source from SVN.
      2. Build and install an egg from this source.
    • Using easy_install:
  2. Configure appropriately for your version of Trac. Update your trac.ini with this:
    tractags.* = enabled
    Be sure to remove any previous TagsPlugin configuration changes. In particular = disabled and default_handler = TagsWikiModule must be removed.
  3. Run trac-admin <env> upgrade on your Trac environment.
  4. Restart your web server.

At this stage the plugin should be working and you should see a text control for tags in your Wiki edit page. You should also see an entry in the main navigation bar labeled Tags. (If you don't, check your anonymous and authenticated users for TAGS_* permisions.)

Configuring TagsPlugin

Tags 0.6 has vastly simplified the configuration to the point where there are only two options, both of which are under the [tags] section:

ignore_closed_tickets = <bool>

Whether to gather tags from closed tickets.

ticket_fields = <field>[, <field> ...]

eg. ticket_fields = component, keywords.

Ticket fields from which to gather tags. Defaults to keywords. Custom fields are currently not supported.

What are tags?

Tags are like hierarchically organized wiki entries, however with them you can categorize a wiki entry under multiple tags and not just under one hierarchy. You can then search for wiki entries categorized under a tag or a collection of tags. In other words, tags provide a faceted classification system for the Trac wiki.

As an added bonus, tags are linked to the wiki entry of the same name, allowing you to describe them explicitly under the wiki entry of the same name. This allows for a flexible means for establishing the context of wiki entries. Besides this, tags also make it incredibly easy to create todo? lists or indexes?.

Tags don't have to be predefined. As long as there are wiki entries categorized under a tag, it'll be automatically created.

Tags are similar to labels in gmail, tags in the social bookmark manager and Flickr. They are substantially different from Wikipedia categories, because tags are associated with wiki entries of the same name, whereas WikiMedia Categories are just indexes.

This implementation of wiki tagging is specific to Trac. To stay consistent with the way Trac names wiki entries, tags are case sensitive. Trac Hacks itself makes extensive use of tagging and is a good example of their use.

How do I apply tags?

To create a tag, follow these steps:

  1. Go to the wiki entry you want to tag.
  2. Click on Edit This Page
  3. Under Change information, Tag under:, enter the tags you want to categorize the entry under. Separate tags with spaces.
  4. Click Save changes.

The wiki entry you edit is now categorized under the tags you specified.

How do I remove a tag from a wiki entry?

To remove a tag from a wiki entry

  1. Go to the wiki entry you want to untag.
  2. Click on Edit This Page
  3. Under Change information, Tag under:, remove the tag from the list.
  4. Click Save changes.

Using the tags

Querying is implemented through the /tags uri handler, the tag:<tag> syntax or Trac Macros as follows

/tags handler

Going to /tags under your project will show a list of all tags in the wiki. /tags/?q=<expression> will show all the objects matching <expression>. e.g. This accepts all the parameters that the ListTagged macro does. e.g.

tag:<tag> or tagged:<expr> Usage

Both forms are identical and link to the tag search results for the expression.

e.g. tagged:todo or tagged:"plugin macro".

Tag expressions

Both the ListTagged macro and the /tags handler use a basic expression language for filtering tagged objects.

Space-separating terms logically ANDs them together.

Operators supported by the language are:

orLogical or
notLogical not
realm:<realm>Restrict to tags in <realm> where realm is wiki, ticket, etc.

Sub-expressions can be grouped inside parentheses (, ).

Expressions and individual tags can be quoted with single ' or double " quotes.


Intersection of macro and plugin tags:

tagged:"macro plugin"

Union of macro and plugin tags:

tagged:"macro or plugin"

Objects tagged macro or plugin, and example

tagged:"(macro or plugin) example"

Macro Usage



This will display a list of resources whose tags match <expr>.


Intersection of macro and plugin tags:

[[ListTagged(macro plugin)]]

Pages tagged macro but not plugin:

[[ListTagged(macro -plugin)]]



Display a cloud of all tags, assuming you do not use the Dummy tag.

Change Log

18214 by rjollos on 2021-04-13 04:08:32
TracTags 0.12.1: Publish 0.12.1 to fix packaging problem
18213 by rjollos on 2021-04-13 04:03:55
TracTags: Fix incorrect metadatga in tag
18146 by Cinc-th on 2021-04-04 12:03:09
TagsPlugin: fixed a string/byte problem with QueryNode. Fixed some tests where we expected a list but got dict_keys instead. Fixed test where sort order of a set was assumed.

Refs #13994

18145 by Cinc-th on 2021-04-04 11:01:16
TagsPlugin: fixes test cases for missing stream filter and additional data in data dict.

Refs #13993

18144 by Cinc-th on 2021-04-04 10:48:52
TagsPlugin: fixed a string/bytes issue. Added more classifiers to

Closes #13994


Attachments (2)

Download all attachments as: .zip