Skip to content

Dynamic Urls #15

@BenLune

Description

@BenLune

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 !

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions