Hi. How can we help?

Tagging documents

Last updated: 16 October 2023

DOCman provides an easy yet convenient way for tagging documents allowing you to set additional filters for searching and displaying selected documents.

Admin tagging interface

Tags may be managed from the backend Tags view. From within this view you may create, edit and delete tags. Each tag listed in this list shows the number of documents that are tagged with it.

A simple click on the counter (on the right side of the tag title) will show all of the documents that are tagged with the corresponding tag.

Only users with Configure permissions may access the tags in the admin interface.

Now let's create some tags! From the backend tags view click on the New button located at the top.

When creating a tag, you are asked for a title and an optional slug. If a slug is not provided, one will automatically get created based on the provided title. Slugs are used as the unique identifier of the tag and they get used for defining tag filters on shortcodes ... more on this later ...

The backend documents list may be filtered by one or more tags by using the corresponding tags filter selector just below the toolbar.

Additionally you may also batch assign tags to one or more documents by simply selecting them and then clicking on the batch toolbar button. This action will bring up a new interface where you may select one or more tags to be assigned to the selected documents.

Tags may also be assigned or removed from the document form when creating or editing a document.

Frontend tags filter

DOCman allows setting tag filters for further refining the list of exposed documents in the frontend. We provide tag filters on our hierarchical, tree and flat list blocks. By assigning tags to these blocks, only documents that are tagged with those selected tags will get displayed in the corresponding blocks.

The method for assigning tags on those blocks depend on the editor that's being used:

Gutenberg editor

When using the Gutenberg editor you may simply click on the DOCman block and set your tags filter on the tags selector.

Shortcodes

Worry not!, you may also assign tag filters when using other editors ... you may simply achieve this by listing your tags in your DOCman shortcodes. For this end you may add one or more tags using the tags attribute in your shortcode:

[docman-flat tags=green,apple]

Matching method

DOCman makes use of a non-strict matching operation for filtering tags. This means that when filtering by two or more tags, documents that match at least one of the tags are returned. It is however possible to change the tags matching behavior by using the DOCman override system.

If you would like the tag filter to match documents that are tagged with every single tag provided, then you need to set the tagging algorithm so that it performs a strict match. For this end you simply need to create a new docman.php located d at SITE_ROOT/wp-content/foliolabs/config with the following content inside:

<?php


return [

'identifiers' => [

'com:docman.model.behavior.taggable' => ['strict' => true]

]

];

What this does is simply changing the configuration of the taggable behavior so that it performs a strict match ... easy enough right?