# How to find routes or use relative URL that includes dynamic fields

**URL:** https://meta.discourse.org/t/how-to-find-routes-or-use-relative-url-that-includes-dynamic-fields/208252
**Category:** Support
**Created:** [November 4, 2021, 2:37pm UTC](https://meta.discourse.org/t/how-to-find-routes-or-use-relative-url-that-includes-dynamic-fields/208252 "2021-11-04T14:37:38Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Mr.X\_Mr.X](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mr.x_mr.x/32/126610_2.png) [@Mr.X\_Mr.X](https://meta.discourse.org/u/Mr.X_Mr.X)
#### Post date: [November 4, 2021, 2:37pm UTC](https://meta.discourse.org/t/how-to-find-routes-or-use-relative-url-that-includes-dynamic-fields/208252/1 "2021-11-04T14:37:38Z")

</div>

I’m trying to add routes to one of the plugins I’m using (Discourse Tab Bar) and I couldn’t find anything relevant or easy to understand for me by searching the meta.

I’m trying to identify the route name that leads to for example:

`domain.com/u/admin/follow/feed`

I know that I can use either a predefined route name or a relative URL. Here is the question:

1. How can i find the list of all the predefined routes? (if there even is such a list)

2. How can I use a relative URL when the URL contains the username in the URL (or other dynamic text like groups names)? For example for URLs that in the Preferences panel.

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [November 4, 2021, 2:51pm UTC](https://meta.discourse.org/t/how-to-find-routes-or-use-relative-url-that-includes-dynamic-fields/208252/2 "2021-11-04T14:51:44Z")

</div>

> [@Mr.X\_Mr.X](#):
>
> How can I use a relative URL when the URL contains the username in the URL (or other dynamic text like groups names)? **For example for URLs that in the Preferences panel**.

This one I know. 🙂 You can swop out `/u/username` for `my` to create a generic link.

Eg.

`https://meta.discourse.org/u/jammydodger/preferences/account`

Becomes

`https://meta.discourse.org/my/preferences/account`

[https://meta.discourse.org/my/preferences/account](https://meta.discourse.org/my/preferences/account)

---

<div class="post-metadata">

### Author: ![Mr.X\_Mr.X](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mr.x_mr.x/32/126610_2.png) [@Mr.X\_Mr.X](https://meta.discourse.org/u/Mr.X_Mr.X)
#### Post date: [November 4, 2021, 2:59pm UTC](https://meta.discourse.org/t/how-to-find-routes-or-use-relative-url-that-includes-dynamic-fields/208252/3 "2021-11-04T14:59:08Z")

</div>

Thank you @JammyDodger, that helped a lot.

LE: I’m still looking for an answer regarding the routes cause it seems that for the theme I’m using [https://meta.discourse.org/t/discourse-tab-bar-for-mobile/](https://meta.discourse.org/t/discourse-tab-bar-for-mobile/) using the relative URL the active button is not changing its color like it’s suppose to.

---

<div class="post-metadata">

### Author: ![Don](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/don/32/228726_2.png) [@Don](https://meta.discourse.org/u/Don)
#### Post date: [November 4, 2021, 6:06pm UTC](https://meta.discourse.org/t/how-to-find-routes-or-use-relative-url-that-includes-dynamic-fields/208252/4 "2021-11-04T18:06:34Z")

</div>

Hello,

I am also using Discourse Tab Bar and Follow plugin. I also added the `/my/follow/feed` url to Discourse Tab Bar. The tab activation didn’t work on my forum too 😁 Now I made a little css hack to make this work.

I target the current body class which is `.user-follow-page` this help us to keep the css modification on follow page. With this class we can easily target the relevant Discourse Tab Bar tab.

What we have to do is change the stucked active tab color to the default _(non active)_ and add the active tab color to that tab which has the `data-destination` `/my/follow/feed`.

data-destination is the url you set up in the Tab Bar theme component to tabs.

Add this to a new component mobile css section.

```plaintext
body.user-follow-page {
  .d-tab-bar {
    .tab {
      &.active {
        color: var(--primary-medium);
      }
      &[data-destination="/my/follow/feed"] {
        color: var(--tertiary);
      }
    }
  }
}

```

* * *

> [@Mr.X\_Mr.X](#):
>
> How can i find the list of all the predefined routes? (if there even is such a list)

I believe this is it [discourse/app/assets/javascripts/discourse/app/routes/app-route-map.js at 9d5da2b383765becb824a8f3ff3665abc8e527fa · discourse/discourse · GitHub](https://github.com/discourse/discourse/blob/9d5da2b383765becb824a8f3ff3665abc8e527fa/app/assets/javascripts/discourse/app/routes/app-route-map.js)

---

<div class="post-metadata">

### Author: ![Mr.X\_Mr.X](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mr.x_mr.x/32/126610_2.png) [@Mr.X\_Mr.X](https://meta.discourse.org/u/Mr.X_Mr.X)
#### Post date: [November 4, 2021, 6:22pm UTC](https://meta.discourse.org/t/how-to-find-routes-or-use-relative-url-that-includes-dynamic-fields/208252/5 "2021-11-04T18:22:17Z")

</div>

Fantastic reply. ❤ :awthanks:

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [December 4, 2021, 6:22pm UTC](https://meta.discourse.org/t/how-to-find-routes-or-use-relative-url-that-includes-dynamic-fields/208252/6 "2021-12-04T18:22:48Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
