<commit_before>---
title: Taxonomy
parent: /manual.html
layout: manual_layout
section: Publishing
owner_slack: "@tijmen"
review_by: 2017-05-01
---

# Taxonomy

GOV.UK's "single subject taxonomy" will describe all content on GOV.UK. It is being developed theme-by-theme, starting with education.

## 1. Editing taxonomy

The taxonomy is managed in [content-tagger][edit-taxonomy].

The topics in the taxonomy (we call them "taxons" in code) are persisted in the publishing-api as content items. For an example [see the "Education" taxon][education-taxon].

The link type `parent_taxons` is used to store the relationship between taxons. Link expansion makes sure that the taxons will have a `child_taxons` link type too.

## 2. Tagging

All pages can be tagged to the taxonomy, currently in [content-tagger][content-tagger] too.

In the future, editors will also be able to tag to the taxonomy in publishing apps like [Whitehall][whitehall].

The relationship between a page and a taxon is persisted in the publishing-api "links hash". For example, see the [taxons link in the content item for this guidance document][example-guidance].

## 3. Accessing the taxonomy

This is the content item for the top-level "Education" taxon:

[https://www.gov.uk/api/content/education][education-taxon]

You can use this to find the structure of the taxonomy by following the `child_taxons` links.

To manipulate and browse taxonomies in ruby code, use the [govuk_taxonomy_helpers](http://www.rubydoc.info/gems/govuk_taxonomy_helpers) gem.

## 4. Accessing tagged content

All content tagged to a particular taxon you fetch from the search API ([rummager][rummager]).

This works with a `content_id` rather than URL. To find all content tagged to the above mentioned ["Education taxon"][education-taxon]:

[https://www.gov.uk/api/search.json?filter_taxons[]=c58fdadd-7743-46d6-9629-90bb3ccc4ef0](https://www.gov.uk/api/search.json?filter_taxons[]=c58fdadd-7743-46d6-9629-90bb3ccc4ef0)

You can also access all content tagged to a taxon and the part of the taxonomy below it. The following will give you everything tagged to topics in the "Education" taxonomy:
<commit_msg>Update taxonomy documentation<commit_after>---
title: Taxonomy
parent: /manual.html
layout: manual_layout
section: Publishing
owner_slack: "#taxonomy"
review_by: 2017-09-01
---

# Taxonomy

GOV.UK's "single subject taxonomy" will describe all content on GOV.UK. It is being developed theme-by-theme, starting with education.

## 1. Editing taxonomy

The taxonomy is managed in [content-tagger][edit-taxonomy].

The topics in the taxonomy (we call them "taxons" in code) are persisted in the publishing-api as content items. For an example [see the "Education" taxon][education-taxon].

The link type `parent_taxons` is used to store the relationship between taxons. Link expansion makes sure that the taxons will have a `child_taxons` link type too.

## 2. Tagging

All pages can be tagged to the taxonomy, currently in [content-tagger][content-tagger] too.

Pages that belong to selected organisations (like those related to the education theme) can be tagged to the taxonomy in [Whitehall][whitehall].

The relationship between a page and a taxon is persisted in the publishing-api "links hash". For example, see the [taxons link in the content item for this guidance document][example-guidance].

## 3. Accessing the taxonomy

This is the content item for the top-level "Education" taxon:

[https://www.gov.uk/api/content/education][education-taxon]

It is visible on [gov.uk/education](https://www.gov.uk/education)

You can use this to find the structure of the taxonomy by following the `child_taxons` links.

## 4. Accessing tagged content

All content tagged to a particular taxon you fetch from the search API ([rummager][rummager]).

This works with a `content_id` rather than URL. To find all content tagged to the above mentioned ["Education taxon"][education-taxon]:

[https://www.gov.uk/api/search.json?filter_taxons[]=c58fdadd-7743-46d6-9629-90bb3ccc4ef0](https://www.gov.uk/api/search.json?filter_taxons[]=c58fdadd-7743-46d6-9629-90bb3ccc4ef0)

You can also access all content tagged to a taxon and the part of the taxonomy below it. The following will give you everything tagged to topics in the "Education" taxonomy:

{'fraction_non_alphanumeric': 0.08756404285048905, 'fraction_numerical': 0.022356776897997206, 'mean_word_length': 4.780619111709287, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 7, 'lorem ipsum': 0, 'www.': 8, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2111121', 'n_tokens_mistral': 1370, 'n_tokens_neox': 1264, 'n_words': 530}