{"result":{"depiction_url":null,"edges":{"hasreference":{"objects":[{"created":"2026-10-07T11:13:40Z","object_id":{"id":2961,"is_a":["text","documentation","developerguide"],"name":"developer_template_extensions","title":{"_type":"trans","tr":{"en":"Add a filter or rendering component"}},"uri":"https:\/\/zotonic.com\/id\/2961"},"seq":1}],"predicate":{"id":2774,"is_a":["meta","predicate"],"name":"hasreference","title":{"_type":"trans","tr":{"en":"Documentation reference"}},"uri":"https:\/\/zotonic.com\/id\/hasreference"}},"references":{"objects":[{"created":"2020-05-30T05:47:34Z","object_id":{"id":1291,"is_a":["text","documentation","reference","template_scomp"],"name":"doc_template_scomp_scomp_menu","title":"menu","uri":"https:\/\/zotonic.com\/id\/1291"},"seq":1000000}],"predicate":{"id":332,"is_a":["meta","predicate"],"name":"references","title":{"_type":"trans","tr":{"en":"References"}},"uri":"https:\/\/zotonic.com\/id\/references"}},"subject":{"objects":[{"created":"2026-10-07T11:13:40Z","object_id":{"id":2557,"is_a":["categorization","keyword","keyword_information_type"],"name":"zotonic_topic_cookbook_recipe","title":"Cookbook recipe","uri":"https:\/\/zotonic.com\/id\/2557"},"seq":1},{"created":"2026-10-07T11:13:40Z","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-10-07T11:13:40Z","object_id":{"id":2623,"is_a":["categorization","keyword","keyword_architecture"],"name":"zotonic_topic_scomp","title":"Server component","uri":"https:\/\/zotonic.com\/id\/2623"},"seq":3},{"created":"2026-10-07T11:13:40Z","object_id":{"id":2620,"is_a":["categorization","keyword","keyword_architecture"],"name":"zotonic_topic_template","title":"Template","uri":"https:\/\/zotonic.com\/id\/2620"},"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":1574,"is_a":["text","documentation","cookbook"],"links":[{"rel":"self","target":"https:\/\/zotonic.com\/.zotonic\/websub\/topic\/1574"},{"rel":"hub","target":"https:\/\/zotonic.com\/.zotonic\/websub"}],"medium":null,"medium_url":null,"name":"doc_cookbook_custom_tag","page_url":{"en":"https:\/\/zotonic.com\/cookbook\/1574\/create-a-custom-template-tag","x-default":"https:\/\/zotonic.com\/cookbook\/1574\/create-a-custom-template-tag"},"preview_url":null,"resource":{"version":32,"pivot_location_lat":null,"title":{"_type":"trans","tr":{"en":"Create a custom template tag"}},"is_authoritative":true,"body":{"_type":"trans","tr":{"en":"<p>In the active Garden module, create <code>src\/scomps\/scomp_garden_greeting.erl<\/code>:<\/p>\n<pre class=\"notranslate\"><code class=\"notranslate language-erlang\">-module(scomp_garden_greeting).\n-behaviour(zotonic_scomp).\n-export([render\/3, vary\/2]).\n\nvary(_Params, _Context) -&gt; nocache.\nrender(Params, _Vars, _Context) -&gt;\n    Name = proplists:get_value(name, Params, &lt;&lt;&quot;visitor&quot;&gt;&gt;),\n    {ok, [&lt;&lt;&quot;Hello, &quot;&gt;&gt;, z_html:escape(z_convert:to_binary(Name))]}.\n<\/code><\/pre>\n<p>Compile and refresh module discovery. In a template:<\/p>\n<pre class=\"notranslate\"><code class=\"notranslate language-django\">&lt;p&gt;{% greeting name=&quot;Alice&quot; %}&lt;\/p&gt;\n<\/code><\/pre>\n<p>Expect “Hello, Alice”. Test a name containing <code>&lt;<\/code> and <code>&amp;<\/code> too: it must appear as text. <code>render\/3<\/code> receives tag parameters, template variables and the current site context. <code>vary\/2<\/code> declares caching behaviour; this example deliberately uses <code>nocache<\/code>. For simple transformations of one input value, use a filter instead.<\/p>"}},"slug":"create-a-custom-template-tag","is_protected":false,"visible_for":0,"tz":"UTC","language":["en"],"is_featured":false,"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"},"category_id":{"id":318,"is_a":["meta","category"],"name":"cookbook","title":{"_type":"trans","tr":{"en":"Cookbook"}},"uri":"https:\/\/test.zotonic.com\/id\/318"},"publication_start":"2022-02-15T10:01:00Z","is_website_redirect":false,"github_url":"https:\/\/github.com\/zotonic\/zotonic\/tree\/master\/doc\/cookbook\/custom-tag.rst","pivot_location_lng":null,"name":"doc_cookbook_custom_tag","is_unfindable":false,"is_published":true,"doc_editorial_edges":{"hasreference":[2961],"subject":[2557,2564,2620,2623]},"summary":{"_type":"trans","tr":{"en":"Render escaped text through the current zotonic_scomp behaviour."}},"pivot_geocode":null,"custom_slug":false,"created":"2020-05-30T05:47:26Z","uri":null,"date_is_all_day":false,"is_dependent":false,"is_page_path_multiple":false,"publication_end":"9999-08-17T12:00:00Z","modifier_id":{"id":1,"is_a":["person"],"name":"administrator","title":"Site Administrator","uri":"https:\/\/zotonic.com\/id\/1"},"privacy":0,"doc_editorial_bundle":true,"creator_id":{"id":336,"is_a":["person","robot"],"name":"gitbot","title":"Git","uri":"https:\/\/zotonic.com\/id\/336"},"seo_noindex":false,"modified":"2026-10-07T11:13:49Z","title_slug":{"_type":"trans","tr":{"en":"create-a-custom-template-tag"}}},"uri":"https:\/\/zotonic.com\/id\/1574","uri_template":"https:\/\/zotonic.com\/id\/:id","websub":{"hub":"https:\/\/zotonic.com\/.zotonic\/websub","topic":"https:\/\/zotonic.com\/.zotonic\/websub\/topic\/1574"}},"status":"ok"}