Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a #routes or #link_to Tag #117

Open
thecodechef opened this issue Jan 13, 2023 · 2 comments
Open

Add a #routes or #link_to Tag #117

thecodechef opened this issue Jan 13, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@thecodechef
Copy link

Is your feature request related to a problem? Please describe.
I'm currently looking for a way to add my routes in my leaf templates

<a href="#routes(home)">Home</a>
# => <a href="/home">Home</a>

Describe the solution you'd like
I would like for a way to add routes to leaf templates

Describe alternatives you've considered
thought about hardcoding them but that is too tedious and it doesn't scale very well

Additional context
As an Example here is a Rails

<%= link_to "Home", @home %>
# => <a href="/home">Home</a>
@thecodechef thecodechef added the enhancement New feature or request label Jan 13, 2023
@thecodechef
Copy link
Author

@natebird @tonyarnold @ts @shnhrrsn
Just wanting to know if there is anyway for this in the future

@thecodechef thecodechef changed the title Add a #routes Tag Add a #routes or #link_to Tag Jan 22, 2023
@danpalmer
Copy link

+1 for this, in fact it feels like quite a blind spot in Vapor's type safety, the fact that URLs are all produced with string concatenation. Having a URL builder interface to the router, that is validated as much as possible, and then exposed in Leaf templates, would be really nice. Even in a small Vapor application I've wanted this quite a few times.

I'll probably end up writing something for this myself, if it becomes generically applicable then I'll try and contribute it or at least get a gist up somewhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants