Loading...
Skip to Content

Tagging in Contentful

Contentful is introducing taxonomy, and why it is important.

What is taxonomy?

Simply put taxonomy is classifying objects by characteristics or usage. In terms of a CMS this can be grouping pages by type, it could be used for categorising images, it could even be used change how a page is rendered.

Why is this important?

Contentful is a great CMS, but I have always found it limiting, and I have had to use workarounds to achieve what I wanted to do. But the introduction of tagging, even if it isn't fully available in the .net core SDK yet, has already changed the way I built my photography gallery.

Taxonomy will allow Contentful to compete with the more enterprise CMS platforms like Sitecore, Episerver and Tridion which all have strong taxonomy features.

So what have I done differently in the photography gallery?

Previously the only way I could add images to an entry in contentful was to have a multi asset field and drag each one on manually, but this was very difficult to manage with a lot of images. When tagging was introduced I created a new Tag Gallery content model which is a lot easier to work with and now only has a string field to add in the tag I was to find assets for. The code isn't the nicest just now, as I mentioned the SDK doesn't support tags just yet, so this is what I had to do.

var assetsQueryBuilder = QueryBuilder<Asset>.New.FieldEqualsAll("metadata.tags.sys.id", new List<string> { tag });
var qs = assetsQueryBuilder.Build();
var assets = await _client.GetAssets(assetsQueryBuilder);

Tagged Gallery Tagged Gallery

What else can be done with taxonomy?

That is an interesting question, and I think a better way of thinking about it is "I have this problem, can it be fixed or done better with tagging or is there a better way?"

As you can see from the screenshots/code snippet, tagging photos and using that tag to get the images is a much nicer editor experience than using an area and dragging all the images in.

What should Contentful do next?

They need to get them working in all the SDKs! Once this is done.

The admin interface for them is also quite basic, and will need more work, features like limiting to only entries or only asset would be nice to see. A validation on a string field (with a dropdown appearance) would make my tag field much nicer, but equally once the tagging is properly in the SDK I can read the tag(s) from the gallery entry and apply them to the QueryBuilder<Asset> to get the images with the same tags.

Original Gallery Original Gallery

Andy Blyth

Andy Blyth, a Technical Architect with a keen interest in martial arts, occasionally ventures into blogging when memory serves.

Andy Blyth