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

Dynamic Urls #15

Open
BenLune opened this issue Jul 14, 2020 · 0 comments
Open

Dynamic Urls #15

BenLune opened this issue Jul 14, 2020 · 0 comments

Comments

@BenLune
Copy link

BenLune commented Jul 14, 2020

Hi Brandon,
Thank you for this initiative !
Regarding to my experience working with Angular, the router and Drupal, I would like to give you some points to get in mind regarding routing.
In real web projects, I think we can't rely on static urls to route components. Using Drupal as backend, for example, the url are managed by the contributors, and Angular can't know all of them.

For SEO or readability reason, a news can have a url like that :
in english :
https://www.mydomain.com/en/07/14/2020/my-great-news
in french :
https://www.mydomain.com/fr/14/07/2020/ma-super-news

I think we shouldn't trust the url only to take the routing decision and, in fine, the application structure. To my point of view, the Angular defined urls should be only technical/internal and not necessarily displayed.

In the projets I'm working on, I create some routes "templates" by contentTypes (empty paths, component, data etc.). When I get the url, if I don't know what is this url, I ask Drupal for it (on direct access only / app boot), regarding to the content type, I check my route templates to find the right route. Once I found it, I update its path (with the Drupal one, to get also a nice url), if the route is not in the Router configs, then I add it, then I navigateToUrl.
Thanks to this approach I can also mix static routes.

I just wanted to give you another point of view ;-)

Good luck !

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

No branches or pull requests

1 participant