<p>Your plugin has to create those routes &mdash; via <a href="https://craftcms.com/docs/plugins/hooks-reference#registerCpRoutes" rel="nofollow"><code>registerCpRoutes()</code></a> &mdash; to match your desired URL structure.</p>

<p>Routes either trigger a site template or a controller, as described in the <a href="https://craftcms.com/docs/routing" rel="nofollow">Routing</a> docs. <em>(Craft's own internal convention is for CP routes to trigger a controller method, which sets up the request and renders your desired template.)</em></p>

<p>You can look at Craft's own CP routes for inspiration in setting up your own; they're defined in <code>/app/etc/config/common.php</code>.</p>

CC BY-SA 3.0
2016-02-14T20:37:27.553Z
2016-02-14T20:37:27.553Z
Michael Rog
<p>In the Entries tab in the Control Panel, I see a list of Sources on the left hand side:</p>

<ul>
<li>All Entries</li>
<li>Singles</li>
<li>News</li>
</ul>

<p>When I click on each of these sources the page filters the appropriate results in the body and the URL gets updated appropriately:</p>

<ul>
<li>All Entries => <code>/admin/entries</code></li>
<li>Singles => <code>/admin/entries/singles</code></li>
<li>News => <code>/admin/entries/news</code></li>
</ul>

<p>This is nice as I can now send links to other people to a specific sub-section in the sources, with the contents already filtered.</p>

<p>I've compared my code in the source <code>nav</code> to the code on the Entries Element Index page, and they are comparable, including passing the <code>data-handle</code> value to each source. But it's still not working in my Custom Element type. I must be missing something but I haven't yet figured out what.</p>

<p>How do we get this behavior working for custom Element Types?</p>

<routes><elementtype><routing><sources>
How do I setup my Element Types Sources for deep linking?
# How do I setup my Element Types Sources for deep linking?

(Asked by: username_0 on 2016-01-24)

In the Entries tab in the Control Panel, I see a list of Sources on the left hand side:

* All Entries
* Singles
* News

When I click on each of these sources the page filters the appropriate results in the body and the URL gets updated appropriately:

* All Entries => `/admin/entries`
* Singles => `/admin/entries/singles`
* News => `/admin/entries/news`

This is nice as I can now send links to other people to a specific sub-section in the sources, with the contents already filtered.

I've compared my code in the source `nav` to the code on the Entries Element Index page, and they are comparable, including passing the `data-handle` value to each source. But it's still not working in my Custom Element type. I must be missing something but I haven't yet figured out what.

How do we get this behavior working for custom Element Types?

**Tags:** routes, elementtype, routing, sources


---

## 1 answers

### Answer by username_1 on 2016-02-14. Score: 1

Your plugin has to create those routes — via [`registerCpRoutes()`](https://craftcms.com/docs/plugins/hooks-reference#registerCpRoutes) — to match your desired URL structure.

Routes either trigger a site template or a controller, as described in the [Routing](https://craftcms.com/docs/routing) docs. *(Craft's own internal convention is for CP routes to trigger a controller method, which sets up the request and renders your desired template.)*

You can look at Craft's own CP routes for inspiration in setting up your own; they're defined in `/app/etc/config/common.php`.


---

