{"result":{"depiction_url":null,"edges":{"in_module":{"objects":[{"created":"2026-09-09T13:48:12Z","object_id":{"id":335,"is_a":["text","documentation","reference","module"],"name":"doc_core","title":"Zotonic Core","uri":"https:\/\/zotonic.com\/id\/335"},"seq":1}],"predicate":{"id":333,"is_a":["meta","predicate"],"name":"in_module","title":{"_type":"trans","tr":{"en":"In module"}},"uri":"https:\/\/zotonic.com\/id\/in_module"}},"subject":{"objects":[{"created":"2026-09-09T13:48:12Z","object_id":{"id":2555,"is_a":["categorization","keyword","keyword_information_type"],"name":"zotonic_topic_reference","title":"Reference","uri":"https:\/\/zotonic.com\/id\/2555"},"seq":1},{"created":"2026-09-09T13:48:12Z","object_id":{"id":2564,"is_a":["categorization","keyword","keyword_audience"],"name":"zotonic_topic_backend_developer","title":"Backend developer","uri":"https:\/\/zotonic.com\/id\/2564"},"seq":2},{"created":"2026-09-09T13:48:12Z","object_id":{"id":2573,"is_a":["categorization","keyword","keyword_domain"],"name":"zotonic_topic_categorization","title":"Categorization","uri":"https:\/\/zotonic.com\/id\/2573"},"seq":3},{"created":"2026-09-09T13:48:12Z","object_id":{"id":2615,"is_a":["categorization","keyword","keyword_architecture"],"name":"zotonic_topic_category","title":"Category","uri":"https:\/\/zotonic.com\/id\/2615"},"seq":4},{"created":"2026-09-09T13:48:12Z","object_id":{"id":2625,"is_a":["categorization","keyword","keyword_architecture"],"name":"zotonic_topic_model","title":"Model","uri":"https:\/\/zotonic.com\/id\/2625"},"seq":5},{"created":"2026-09-09T13:48:12Z","object_id":{"id":2643,"is_a":["categorization","keyword","keyword_task"],"name":"zotonic_topic_query","title":"Query","uri":"https:\/\/zotonic.com\/id\/2643"},"seq":6}],"predicate":{"id":308,"is_a":["meta","predicate"],"name":"subject","title":{"_type":"trans","tr":{"en":"Keyword"}},"uri":"http:\/\/purl.org\/dc\/elements\/1.1\/subject"}}},"id":1283,"is_a":["text","documentation","reference","model"],"links":[{"rel":"self","target":"https:\/\/zotonic.com\/.zotonic\/websub\/topic\/1283"},{"rel":"hub","target":"https:\/\/zotonic.com\/.zotonic\/websub"}],"medium":null,"medium_url":null,"name":"doc_model_model_category","page_url":{"en":"https:\/\/zotonic.com\/docs\/1283\/category","x-default":"https:\/\/zotonic.com\/docs\/1283\/category"},"preview_url":null,"resource":{"version":3977,"pivot_location_lat":null,"title":"category","is_authoritative":true,"body":"<p>This model can retrieve information about the resource category hierarchy in different ways.<\/p>\n<p>Categories are the principal categorization (typing) system of resources. Every page is assigned to exactly one\ncategory. Categories themselves are organized in a tree-like hierarchy.<\/p>\n<p>A category is a resource with a special <code>category<\/code> record attached to it to store metadata related to the category\nhierarchy. The <code>m_category<\/code> model provides accessors to this category tree and individual category information.<\/p>\n<p>An example of a category tree, as returned by <code>{% print m.category.tree %}<\/code>:<\/p>\n<pre class=\"notranslate\"><code class=\"notranslate language-erlang\">[[{id,101},\n  {parent_id,undefined},\n  {level,1},\n  {children,[]},\n  {path,&quot;e&quot;},\n  {left,1000000},\n  {right,1000000}],\n [{id,104},\n  {parent_id,undefined},\n  {level,1},\n  {children,[[{id,106},\n              {parent_id,104},\n              {level,2},\n              {children,[[{id,109},\n                          {parent_id,106},\n                          {level,3},\n                          {children,[]},\n                          {path,&quot;hjm&quot;},\n                          {left,4000000},\n                          {right,4000000}]]},\n              {path,&quot;hj&quot;},\n              {left,3000000},\n              {right,4000000}]]},\n  {path,&quot;h&quot;},\n  {left,2000000},\n  {right,4000000}],\n  ...]\n<\/code><\/pre>\n<h2>About the complete category tree<\/h2>\n<p>The following m_category model properties are available in templates:<\/p>\n<table class=\"table\"><thead><tr><th>Property<\/th><th>Description<\/th><th>Example value<\/th><\/tr><\/thead><tbody><tr><td>tree<\/td><td>Return the complete forest of category trees as nested property lists.<\/td><td><code>See above.<\/code><\/td><\/tr><tr><td>tree2<\/td><td>Return the forest of category trees as nested property lists. Up to the children of the children.<\/td><td><code>See above.<\/code><\/td><\/tr><tr><td>tree_flat<\/td><td>Return a list of tuples for the category tree. This list is intended for select lists. There is a special field for the indentation. The returned list consists of proplists. The list does not contain the &quot;meta&quot; category, which contains the categories &quot;predicate&quot;, &quot;category&quot; etc.<\/td><td><code>See above entries.<\/code><\/td><\/tr><tr><td>tree_flat_meta<\/td><td>Same as tree_flat but with the categories in the meta category.<\/td><td><code>See above entries.<\/code><\/td><\/tr><\/tbody><\/table>\n<h2>About a single category<\/h2>\n<p>The m_category has some special properties defined when fetching a category, they are accessed by id or category name.\nFor example:<\/p>\n<pre class=\"notranslate\"><code class=\"notranslate language-erlang\">{{ m.category[104].tree }}\n{{ m.category.text.tree }}\n<\/code><\/pre>\n<table class=\"table\"><thead><tr><th>Property<\/th><th>Description<\/th><th>Example value<\/th><\/tr><\/thead><tbody><tr><td>tree<\/td><td>The category tree below and including the indexing category.<\/td><td><code>See above.<\/code><\/td><\/tr><tr><td>tree1<\/td><td>The list of direct children below the indexing category.<\/td><td><code>See above.<\/code><\/td><\/tr><tr><td>tree2<\/td><td>The category tree below and including the indexing category, up to the children of the children.<\/td><td><code>See above.<\/code><\/td><\/tr><tr><td>tree_flat<\/td><td>The category tree below and including the indexing category, up to the children of the children. As a flattened list.<\/td><td><code>See above.<\/code><\/td><\/tr><tr><td>path<\/td><td>List of parent category ids from the root till the category, excluding the indexing category.<\/td><td><code>[ 104, 106 ]<\/code><\/td><\/tr><tr><td>is_a<\/td><td>List of the parent category names form the root till the category, including the current category.<\/td><td><code>[ text, article, news ]<\/code><\/td><\/tr><tr><td>image<\/td><td>A random depiction for this category. The returned image filename comes from one of the pages within this category.<\/td><td><code>&lt;&lt;&quot;2009\/10\/20\/flat-world-proof.jpg&quot;&gt;&gt;<\/code><\/td><\/tr><tr><td>parent_id<\/td><td>The page id of the parent category. Returns an integer or, for a root category, undefined.<\/td><td><code>104<\/code><\/td><\/tr><tr><td>nr<\/td><td>The category nr. Used for building the tree, will change when categories are added or removed. An integer.<\/td><td><code>2<\/code><\/td><\/tr><tr><td>level<\/td><td>The depth of the category. Level 1 is the root, 2 and more are below the root.<\/td><td><code>1<\/code><\/td><\/tr><tr><td>left<\/td><td>The lowest value of the nr range of this category, including its sub categories.<\/td><td><code>2<\/code><\/td><\/tr><tr><td>right<\/td><td>The highest value of the nr range of this category, including its sub categories.<\/td><td><code>8<\/code><\/td><\/tr><tr><td>name<\/td><td>The unique page name of this category. A binary.<\/td><td><code>&lt;&lt;&quot;text&quot;&gt;&gt;<\/code><\/td><\/tr><tr><td>path<\/td><td>The path through the hierarchy of categories to this category.<\/td><td><code>[104, 106]<\/code><\/td><\/tr><\/tbody><\/table>\n<h2>Available Model API Paths<\/h2>\n<table class=\"table\"><thead><tr><th>Method<\/th><th>Path pattern<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td><code>get<\/code><\/td><td><code>\/tree\/...<\/code><\/td><td>Return full category forest as nested hierarchy records (all non-meta roots and descendants).<\/td><\/tr><tr><td><code>get<\/code><\/td><td><code>\/tree2\/...<\/code><\/td><td>Return category forest in the limited <code>tree2<\/code> representation (up to grandchildren level).<\/td><\/tr><tr><td><code>get<\/code><\/td><td><code>\/menu\/...<\/code><\/td><td>Return category forest formatted for menu rendering (hierarchy plus display metadata).<\/td><\/tr><tr><td><code>get<\/code><\/td><td><code>\/tree_flat\/...<\/code><\/td><td>Return flattened category list for selection UIs, excluding the <code>meta<\/code> branch.<\/td><\/tr><tr><td><code>get<\/code><\/td><td><code>\/tree_flat_meta\/...<\/code><\/td><td>Return flattened category list including the <code>meta<\/code> branch categories.<\/td><\/tr><tr><td><code>get<\/code><\/td><td><code>\/is_used\/+cat\/...<\/code><\/td><td>Return whether any resource is assigned to <code>+cat<\/code> or one of its descendant categories.<\/td><\/tr><tr><td><code>get<\/code><\/td><td><code>\/+cat\/path\/...<\/code><\/td><td>Return ancestor category id path for <code>+cat<\/code>; returns <code>undefined<\/code> when category is unknown.<\/td><\/tr><tr><td><code>get<\/code><\/td><td><code>\/+cat\/is_a\/...<\/code><\/td><td>Return <code>is_a<\/code> ancestry (category names) for <code>+cat<\/code>; returns <code>undefined<\/code> when category is unknown.<\/td><\/tr><tr><td><code>get<\/code><\/td><td><code>\/+cat\/tree\/...<\/code><\/td><td>Return nested subtree rooted at <code>+cat<\/code>; returns <code>undefined<\/code> when category is unknown.<\/td><\/tr><tr><td><code>get<\/code><\/td><td><code>\/+cat\/tree_flat\/...<\/code><\/td><td>Return flattened subtree list rooted at <code>+cat<\/code>; returns <code>undefined<\/code> when category is unknown.<\/td><\/tr><tr><td><code>get<\/code><\/td><td><code>\/+cat\/tree1\/...<\/code><\/td><td>Return direct-child tree level for <code>+cat<\/code>; returns <code>undefined<\/code> when category is unknown.<\/td><\/tr><tr><td><code>get<\/code><\/td><td><code>\/+cat\/tree2\/...<\/code><\/td><td>Return subtree of <code>+cat<\/code> in <code>tree2<\/code> format (up to grandchildren); returns <code>undefined<\/code> when unknown.<\/td><\/tr><tr><td><code>get<\/code><\/td><td><code>\/+cat\/image\/...<\/code><\/td><td>Return a random depiction filename from resources in category <code>+cat<\/code>; returns <code>undefined<\/code> when category is unknown.<\/td><\/tr><tr><td><code>get<\/code><\/td><td><code>\/+cat\/...<\/code><\/td><td>Return category record for <code>+cat<\/code> (id\/name\/nr\/level\/left\/right\/parent metadata); returns <code>undefined<\/code> when unknown.<\/td><\/tr><\/tbody><\/table>\n<p><code>\/+name<\/code> marks a variable path segment. A trailing <code>\/...<\/code> means extra path segments are accepted for further lookups.<\/p>","slug":"category","is_protected":false,"visible_for":0,"tz":"UTC","language":["en"],"doc_source_hash":"c30ea7b4f5fd9ade319b5564f7b1ef43c15affcf26fd2647c26a4a20750fe03c","is_featured":false,"content_group_id":{"id":2551,"is_a":["meta","content_group"],"name":"content_group_imported_docs","title":"Imported documentation","uri":"https:\/\/zotonic.com\/id\/content_group_imported_docs"},"category_id":{"id":322,"is_a":["meta","category"],"name":"model","title":"Models","uri":"https:\/\/test.zotonic.com\/id\/322"},"doc_source_path":"apps\/zotonic_core\/src\/models\/m_category.erl","publication_start":"2023-06-24T08:18:03Z","github_url":"https:\/\/github.com\/zotonic\/zotonic\/blob\/master\/apps\/zotonic_core\/src\/models\/m_category.erl","pivot_location_lng":null,"doc_source_kind":"model","name":"doc_model_model_category","is_unfindable":false,"is_published":true,"pivot_geocode":null,"created":"2020-05-30T05:47:16Z","uri":null,"doc_status":"current","is_dependent":false,"erlang_app":"zotonic_core","publication_end":"9999-06-01T00:00:00Z","modifier_id":{"id":1,"is_a":["person"],"name":"administrator","title":"Site Administrator","uri":"https:\/\/zotonic.com\/id\/1"},"privacy":0,"doc_source_commit":"b8c4b2ccdc223257f311968fbd17b2d66f0c4156\n","erlang_module":"m_category","creator_id":{"id":336,"is_a":["person","robot"],"name":"gitbot","title":"Git","uri":"https:\/\/zotonic.com\/id\/336"},"modified":"2026-09-30T09:39:54Z","title_slug":"category"},"uri":"https:\/\/zotonic.com\/id\/1283","uri_template":"https:\/\/zotonic.com\/id\/:id","websub":{"hub":"https:\/\/zotonic.com\/.zotonic\/websub","topic":"https:\/\/zotonic.com\/.zotonic\/websub\/topic\/1283"}},"status":"ok"}