Autocompleting Tags in Contentful
Contentful has a concept of Tags, and these fall into their “content as metadata” approach. This means that Tags are just another type of Short-Text Field you can add, as a List. Contentful has a Tag style appearance choice for these - as in, they are rendered as “pills”.
But they don’t autocomplete!
In my experience, Tags are most useful when they autocomplete as you type things. This lets you keep some kind of consistency in your Tags across documents. Without autocomplete, you end up having “Spiderman” and “Spider man” and “Spider Man” as three different Tags
My UI extension adds a rendering option for Autocompleting tags to Contentful.
Existing tags are shown below the input field. The → key selects the top match.
Where do the tags come from?
Any documents in the Space which have a field called
tags will be searched for. Their contents will then become the autocomplete suggestions for the document you’re editing.
Limitations / Future
Tags are fetched from all documents in the Contentful space every time an editor is opened for a document with this UI extension. This will probably be quite slow if you’ve got a lot of documents in the space. A nice addition would be the option to cache space tags on a Redis cache somewhere, or just in the browser’s local storage.