umbracoumbraco7propertyeditor

Umbraco 7 Limiting possible Tags values


On our website, it is possible to tag content by a country list. This country list could be implemented as a tag control but I'm concerned about mis-spellings creeping in over time. However, the country list is very long (150+) so not ideal for a dropdown multiple control either.

What I'm looking to do is have a control that has the same type + autocomplete functionality as the existing tags control but limit the possible values to those retrieved from a database table.

I also want to be able to list all tags that a piece of content has been tagged against as well as searching for content based on tags e.g. GetNodesWithTags

Has anyone developed anything like this before? I've had a look at packages etc but can't see anything similar. Does anyone have any advice before I start off?


Solution

  • Definitely, using Tags datatype for this may cause a lot of problems :)

    In my opinion, the perfect solution will be to use nuPickers (https://our.umbraco.org/projects/backoffice-extensions/nupickers/) package and available there TypeaheadList Picker.

    Depending of your additional requirements, you may use Lucene index / C# accessed source (totally custom - db, static, enum etc.) / XML file source as a prevalues for your control.

    enter image description here

    Then, you'll be able to create logic which will enable you to perform search based on this field as it will be a typical property with value on the nodes. Once again - suggested way is to use Lucene Examine index as it's tailored to be fast with searching. You can read more about searching with Examine here: https://our.umbraco.org/documentation/reference/searching/examine/.

    Hopefully it will solve your problem.