{"result":{"depiction_url":null,"edges":{"references":{"objects":[{"created":"2020-05-30T05:47:39Z","object_id":{"id":1279,"is_a":["text","documentation"],"name":"doc_glossary","title":"Glossary","uri":"https:\/\/zotonic.com\/id\/1279"},"seq":1000000},{"created":"2020-05-30T05:47:39Z","object_id":{"id":1839,"is_a":["text","documentation","reference","dispatch"],"name":"doc_dispatch_dispatch_mod_admin_dispatch","title":"mod_admin dispatch rules","uri":"https:\/\/zotonic.com\/id\/1839"},"seq":1000000},{"created":"2020-05-30T05:47:39Z","object_id":{"id":1331,"is_a":["text","documentation","reference","module"],"name":"doc_module_mod_admin","title":"mod_admin","uri":"https:\/\/zotonic.com\/id\/1331"},"seq":1000000},{"created":"2020-05-30T05:47:39Z","object_id":{"id":1541,"is_a":["text","documentation","developerguide"],"name":"doc_developerguide_dispatch_rules","title":{"_type":"trans","tr":{"en":"Follow a request to its template"}},"uri":"https:\/\/zotonic.com\/id\/1541"},"seq":1000000},{"created":"2020-05-30T05:47:39Z","object_id":{"id":320,"is_a":["meta","category"],"name":"module","title":"Modules","uri":"https:\/\/test.zotonic.com\/id\/320"},"seq":1000000},{"created":"2020-05-30T05:47:39Z","object_id":{"id":1840,"is_a":["text","documentation","reference"],"name":"doc_reference_global_variables","title":"Global template variables","uri":"https:\/\/zotonic.com\/id\/1840"},"seq":1000000}],"predicate":{"id":332,"is_a":["meta","predicate"],"name":"references","title":{"_type":"trans","tr":{"en":"References"}},"uri":"https:\/\/zotonic.com\/id\/references"}},"refers":{"objects":[{"created":"2026-09-09T13:48:29Z","object_id":{"id":1541,"is_a":["text","documentation","developerguide"],"name":"doc_developerguide_dispatch_rules","title":{"_type":"trans","tr":{"en":"Follow a request to its template"}},"uri":"https:\/\/zotonic.com\/id\/1541"},"seq":1000000},{"created":"2026-09-09T13:48:29Z","object_id":{"id":1839,"is_a":["text","documentation","reference","dispatch"],"name":"doc_dispatch_dispatch_mod_admin_dispatch","title":"mod_admin dispatch rules","uri":"https:\/\/zotonic.com\/id\/1839"},"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-09-09T13:48:29Z","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:29Z","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-09-09T13:48:29Z","object_id":{"id":2608,"is_a":["categorization","keyword","keyword_domain"],"name":"zotonic_topic_routing_and_redirects","title":"Routing and redirects","uri":"https:\/\/zotonic.com\/id\/2608"},"seq":3},{"created":"2026-09-09T13:48:29Z","object_id":{"id":2620,"is_a":["categorization","keyword","keyword_architecture"],"name":"zotonic_topic_template","title":"Template","uri":"https:\/\/zotonic.com\/id\/2620"},"seq":4},{"created":"2026-09-09T13:48:29Z","object_id":{"id":2641,"is_a":["categorization","keyword","keyword_task"],"name":"zotonic_topic_render","title":"Render","uri":"https:\/\/zotonic.com\/id\/2641"},"seq":5},{"created":"2026-09-09T13:48:29Z","object_id":{"id":2667,"is_a":["categorization","keyword","keyword_data_type"],"name":"zotonic_topic_url","title":"URL","uri":"https:\/\/zotonic.com\/id\/2667"},"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":1382,"is_a":["text","documentation","reference","template_tag"],"links":[{"rel":"self","target":"https:\/\/zotonic.com\/.zotonic\/websub\/topic\/1382"},{"rel":"hub","target":"https:\/\/zotonic.com\/.zotonic\/websub"}],"medium":null,"medium_url":null,"name":"doc_template_tag_tag_url","page_url":{"en":"https:\/\/zotonic.com\/docs\/1382\/url","x-default":"https:\/\/zotonic.com\/docs\/1382\/url"},"preview_url":null,"resource":{"version":3372,"pivot_location_lat":null,"title":"url","is_authoritative":true,"body":"<p>Generate the URL for a named dispatch rule. In this way it is possible to automatically change the generated URLs when the dispatch rules are modified.<\/p>\n<p>For example to generate the URL to the admin for editing a <a href=\"\/id\/doc_glossary#term-page\">page<\/a>, use:<\/p>\n<pre class=\"notranslate\"><code class=\"notranslate language-erlang\">{% url admin_edit_rsc id=myid %}\n<\/code><\/pre>\n<p>Assuming myid is 42 then this will generate (on most Zotonic sites) the URL “\/admin\/edit\/42”. The name “admin_edit_rsc” can be found in <a href=\"\/id\/doc_dispatch_dispatch_mod_admin_dispatch\" class=\"doc-reference doc-reference-dispatch\"><code>dispatch#mod_admin\/dispatch<\/code><\/a>. Which <a href=\"\/id\/doc_developerguide_dispatch_rules\">dispatch rules<\/a> are available depends on which <a href=\"\/id\/module#ref-modules\">Modules<\/a> are enabled.<\/p>\n<p>When the dispatch rule named in the first argument is unknown then an empty string is returned. There is no error message. This is to prevent breaking the web site when modules are enabled or disabled.<\/p>\n<p>Arguments not named in the path of the dispatch rule are added to the query string of the returned URL:<\/p>\n<pre class=\"notranslate\"><code class=\"notranslate language-erlang\">{% url admin_edit_rsc id=42 foo=&quot;bar&quot; %}\n<\/code><\/pre>\n<p>Returns the URL “\/admin\/edit\/42?foo=bar”.<\/p>\n<div class=\"admonition note\"><p class=\"first admonition-title\">Note<\/p><p>The preferred way to generate the URL of a page (resource) is:<\/p><pre class=\"notranslate last\"><code class=\"notranslate language-erlang\">{{ m.rsc[myid].page_url }}\n<\/code><\/pre><\/div>\n<h2>Generate absolute URLs<\/h2>\n<p>By default, the <code>{% url %}<\/code> tag generates relative URLs. Add the argument <code>absolute_url<\/code> to generate absolute URLs that include the scheme and hostname:<\/p>\n<pre class=\"notranslate\"><code class=\"notranslate language-erlang\">{% url admin_edit_rsc id=42 foo=&quot;bar&quot; absolute_url %}\n<\/code><\/pre>\n<p>will return a URL like “<a href=\"http:\/\/example.com\/admin\/edit\/42?foo=bar\">http:\/\/example.com\/admin\/edit\/42?foo=bar<\/a>”.<\/p>\n<h2>Finding out the current dispatch rule<\/h2>\n<p>The name of the current dispatch rule is always available in a template under the name <code>zotonic_dispatch<\/code>.<\/p>\n<p>Check <a href=\"\/id\/doc_reference_global_variables#ref-global-variables\">Global template variables<\/a> for a full overview of variables that are always available in the templates.<\/p>","slug":"url","is_protected":false,"visible_for":0,"tz":"UTC","language":["en"],"doc_source_hash":"660b818ec356df353dd44155fcf8c1121d2c65db752ac0fa2be6887f5b8193df","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":324,"is_a":["meta","category"],"name":"template_tag","title":"Tags","uri":"https:\/\/test.zotonic.com\/id\/324"},"doc_source_path":"doc\/template-tags\/url.md","publication_start":"2023-01-30T19:23:59Z","github_url":"https:\/\/github.com\/zotonic\/zotonic\/blob\/master\/doc\/template-tags\/url.md","pivot_location_lng":null,"doc_source_kind":"template_tag","name":"doc_template_tag_tag_url","is_unfindable":false,"is_published":true,"pivot_geocode":null,"created":"2020-05-30T05:47:20Z","uri":null,"doc_status":"current","is_dependent":false,"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":"a9af6256d16f0717b59ea8dcf2a2e0565573bdd4\n","creator_id":{"id":336,"is_a":["person","robot"],"name":"gitbot","title":"Git","uri":"https:\/\/zotonic.com\/id\/336"},"modified":"2026-10-14T14:01:22Z","title_slug":"url"},"uri":"https:\/\/zotonic.com\/id\/1382","uri_template":"https:\/\/zotonic.com\/id\/:id","websub":{"hub":"https:\/\/zotonic.com\/.zotonic\/websub","topic":"https:\/\/zotonic.com\/.zotonic\/websub\/topic\/1382"}},"status":"ok"}