How it works

URL generation

When your document uses SeoAwareTrait you have private property called $url. It contains the url for specific document,which is used for url generation.

Your document must be defined in the configuration of the bundle, under the node seo_routes. There you will define the bundle, controller and action that will be called after the router matches the route in your document.

Don't forget that your document also needs to implement SeoAwareInterface in order to be used by the ONGR router.

Let's say we have following document:

{
    ...,
    "url": "/drums"
}

In order to generate link to this document (referenced by variable product) we would add this line to TWIG template {{ path(product) }}. This will result in drums/

The route ongr_route_product is generated from seo_routes parameter type name, so it's formed by: ongr_route_<type-name>.

URL matching

As shown in README example when url matches document, real object representing document is passed to action instead of original string from URI. This is how it works:

Note that it is default behaviour and it can be easily changed by adding and removing routers from chain. More info

Advanced usage