<p>If I'm not mistaken, I don't think setting up the route via the CP does the fancy advanced rule stuff described <a href="https://docs.craftcms.com/v3/routing.html#advanced-routing-with-url-rules" rel="nofollow noreferrer">here</a>. You'll therefore want to do that via the <code>config/routes.php</code> file with something like this:</p>

<pre><code>'marketplace/&lt;authorSlug:[^\/]+&gt;/&lt;entrySlug:{slug}&gt;/edit' =&gt; ['template' =&gt; 'listings/_edit'],
</code></pre>

<p>Now <code>authorSlug</code> and <code>entrySlug</code> will be available for use in your <code>listings/_edit.twig</code> template...</p>

CC BY-SA 4.0
2018-11-28T16:38:51.787Z
2018-11-28T17:15:02.173Z
2018-11-28T17:15:02.173Z
Jalen Davenport
<p>I currently have a routing set up as follows to enable an "Edit" entry page following on from <a href="https://craftcms.stackexchange.com/questions/28565/edit-entry-page/28571#28571">this question</a> but I'm getting the following error message when going to that page.</p>

<blockquote>
  <p>Variable "entrySlug" does not exist</p>
</blockquote>

<p>I have my routing set up as follows within my CP, which loads a URL like so <code>mydomain.com/marketplace/authorname/entryname/edit</code></p>

<p><a href="https://i.sstatic.net/deO5g.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/deO5g.png" alt="enter image description here"></a></p>

<p>and within my <code>listings/_edit</code></p>

<pre><code>{# Find the entry by slug and author: #}
{% set listing = craft.entries({
    section: 'networks',
    slug: entrySlug,
    author: currentUser
}).one() %}
</code></pre>

<p>I'm really unsure why it can't find the slug of the entry.</p>

<templating><routes><routing>
Variable "entrySlug" does not exist Routing
# Variable "entrySlug" does not exist Routing

(Asked by: username_0 on 2018-11-28)

I currently have a routing set up as follows to enable an "Edit" entry page following on from this question but I'm getting the following error message when going to that page.

Variable "entrySlug" does not exist

I have my routing set up as follows within my CP, which loads a URL like so mydomain.com/marketplace/authorname/entryname/edit

and within my listings/_edit
{# Find the entry by slug and author: #}
{% set listing = craft.entries({
    section: 'networks',
    slug: entrySlug,
    author: currentUser
}).one() %}

I'm really unsure why it can't find the slug of the entry.

**Tags:** templating, routes, routing


---

## 1 answers

### Answer by username_1 on 2018-11-28. Score: 3 | Accepted answer

If I'm not mistaken, I don't think setting up the route via the CP does the fancy advanced rule stuff described here. You'll therefore want to do that via the config/routes.php file with something like this:
'marketplace///edit' => ['template' => 'listings/_edit'],

Now authorSlug and entrySlug will be available for use in your listings/_edit.twig template...


---

