{"result":{"depiction_url":null,"edges":{"hasreference":{"objects":[{"created":"2026-10-07T11:13:35Z","object_id":{"id":1326,"is_a":["text","documentation","reference","template_tag"],"name":"doc_template_tag_tag_include","title":"include","uri":"https:\/\/zotonic.com\/id\/1326"},"seq":1},{"created":"2026-10-07T11:13:35Z","object_id":{"id":1325,"is_a":["text","documentation","reference","template_tag"],"name":"doc_template_tag_tag_catinclude","title":"catinclude","uri":"https:\/\/zotonic.com\/id\/1325"},"seq":2}],"predicate":{"id":2774,"is_a":["meta","predicate"],"name":"hasreference","title":{"_type":"trans","tr":{"en":"Documentation reference"}},"uri":"https:\/\/zotonic.com\/id\/hasreference"}},"refers":{"objects":[{"created":"2026-10-07T11:13:08Z","object_id":{"id":1325,"is_a":["text","documentation","reference","template_tag"],"name":"doc_template_tag_tag_catinclude","title":"catinclude","uri":"https:\/\/zotonic.com\/id\/1325"},"seq":1000000},{"created":"2026-10-07T11:13:08Z","object_id":{"id":1326,"is_a":["text","documentation","reference","template_tag"],"name":"doc_template_tag_tag_include","title":"include","uri":"https:\/\/zotonic.com\/id\/1326"},"seq":1000000},{"created":"2026-10-07T11:13:08Z","object_id":{"id":2941,"is_a":["text","documentation","developerguide"],"name":"developer_template_selection","title":{"_type":"trans","tr":{"en":"Find the template used by a page"}},"uri":"https:\/\/zotonic.com\/id\/2941"},"seq":1000000}],"predicate":{"id":2409,"is_a":["meta","predicate"],"name":"refers","title":{"_type":"trans","tr":{"en":"Refers"}},"uri":"https:\/\/zotonic.com\/id\/refers"}},"subject":{"objects":[{"created":"2026-10-07T11:13:35Z","object_id":{"id":2554,"is_a":["categorization","keyword","keyword_information_type"],"name":"zotonic_topic_how_to_guide","title":"How-to guide","uri":"https:\/\/zotonic.com\/id\/2554"},"seq":1},{"created":"2026-10-07T11:13:35Z","object_id":{"id":2563,"is_a":["categorization","keyword","keyword_audience"],"name":"zotonic_topic_frontend_developer","title":"Frontend developer","uri":"https:\/\/zotonic.com\/id\/2563"},"seq":2},{"created":"2026-10-07T11:13:35Z","object_id":{"id":2620,"is_a":["categorization","keyword","keyword_architecture"],"name":"zotonic_topic_template","title":"Template","uri":"https:\/\/zotonic.com\/id\/2620"},"seq":3},{"created":"2026-10-07T11:13:35Z","object_id":{"id":2641,"is_a":["categorization","keyword","keyword_task"],"name":"zotonic_topic_render","title":"Render","uri":"https:\/\/zotonic.com\/id\/2641"},"seq":4}],"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":2943,"is_a":["text","documentation","developerguide"],"links":[{"rel":"self","target":"https:\/\/zotonic.com\/.zotonic\/websub\/topic\/2943"},{"rel":"hub","target":"https:\/\/zotonic.com\/.zotonic\/websub"}],"medium":null,"medium_url":null,"name":"developer_template_components","page_url":{"en":"https:\/\/zotonic.com\/docs\/2943\/reuse-markup-with-includes-and-categories","x-default":"https:\/\/zotonic.com\/docs\/2943\/reuse-markup-with-includes-and-categories"},"preview_url":null,"resource":{"body":{"_type":"trans","tr":{"en":"<pre class=\"notranslate\"><code class=\"notranslate language-django\">{% include &quot;_garden_card.tpl&quot; id=id %}\n<\/code><\/pre>\n<p>Inside the partial, read the resource using <code>m.rsc[id]<\/code>. Keep the partial focused on one component so another page can reuse it without inheriting unrelated page behavior.<\/p>\n<p>Use a category include when the representation depends on the resource&#39;s category:<\/p>\n<pre class=\"notranslate\"><code class=\"notranslate language-django\">{% catinclude &quot;_garden_card.tpl&quot; id %}\n<\/code><\/pre>\n<p>Provide a generic fallback and add category-specific variants when their markup differs. Use the template selection tools to check which variant wins for the resource. See <a href=\"\/id\/1326\" class=\"doc-reference doc-reference-tag\"><code>tag#include<\/code><\/a>, <a href=\"\/id\/1325\" class=\"doc-reference doc-reference-tag\"><code>tag#catinclude<\/code><\/a>, and <a href=\"\/id\/2941\">Find the template used by a page<\/a>.<\/p>\n<p>For the example above, save the fallback as <code>priv\/templates\/_garden_card.tpl<\/code>. An event-specific version is <code>_garden_card.event.tpl<\/code>. A resource named <code>garden_open_day<\/code> can override both with <code>_garden_card.name.garden_open_day.tpl<\/code>. Test an event and an ordinary text resource: the latter should still use the fallback.<\/p>"}},"category_id":{"id":317,"is_a":["meta","category"],"name":"developerguide","title":"Developer guide","uri":"https:\/\/zotonic.com\/id\/developerguide"},"content_group_id":{"id":339,"is_a":["meta","content_group"],"name":"default_content_group","title":{"_type":"trans","tr":{"en":"Default Content Group"}},"uri":"https:\/\/zotonic.com\/id\/default_content_group"},"created":"2026-10-07T11:12:56Z","creator_id":{"id":1,"is_a":["person"],"name":"administrator","title":"Site Administrator","uri":"https:\/\/zotonic.com\/id\/1"},"doc_editorial_bundle":true,"doc_editorial_edges":{"hasreference":[1325,1326],"subject":[2554,2563,2620,2641]},"is_authoritative":true,"is_dependent":false,"is_featured":false,"is_protected":false,"is_published":true,"is_unfindable":false,"language":["en"],"modified":"2026-10-07T20:45:39Z","modifier_id":{"id":1,"is_a":["person"],"name":"administrator","title":"Site Administrator","uri":"https:\/\/zotonic.com\/id\/1"},"name":"developer_template_components","pivot_geocode":null,"pivot_location_lat":null,"pivot_location_lng":null,"privacy":0,"publication_end":"9999-06-01T00:00:00Z","publication_start":"2026-10-07T11:12:56Z","slug":"reuse-markup-with-includes-and-categories","summary":{"_type":"trans","tr":{"en":"Extract repeated markup into a partial and pass its inputs explicitly."}},"title":{"_type":"trans","tr":{"en":"Reuse markup with includes and categories"}},"title_slug":{"_type":"trans","tr":{"en":"reuse-markup-with-includes-and-categories"}},"tz":"UTC","uri":null,"version":20,"visible_for":0},"uri":"https:\/\/zotonic.com\/id\/2943","uri_template":"https:\/\/zotonic.com\/id\/:id","websub":{"hub":"https:\/\/zotonic.com\/.zotonic\/websub","topic":"https:\/\/zotonic.com\/.zotonic\/websub\/topic\/2943"}},"status":"ok"}