- Documentation >
- Templating >
- URLs and routes >
- URLs and routes
URLs and routes
To link to a Location or Content item, use the ibexa_path()
Twig function.
You need to provide the function with a Location, Content, ContentInfo or RouteReference object:
| <p><a href="{{ ibexa_path(location) }}">Location</a></p>
<p><a href="{{ ibexa_path(content.contentInfo) }}">Content Info</a></p>
|
Use ibexa_url()
to get an absolute URL to a content item or Location:
| <p><a href="{{ ibexa_url(location) }}">Location</a></p>
|
RouteReference
You can use the ibexa_route()
Twig function
to create a RouteReference object based on the provided information.
A RouteReference contains a route with its parameters and can be modified after it is created.
Here, the route is based on the ID of the Location.
| {% set routeReference = ibexa_route("ibexa.url.alias", { 'locationId': 2 }) %}
<p><a href="{{ ibexa_path(routeReference) }}">Route</a></p>
|
A route can also be based on the ID of the content item.
The resulting link points to the content item's main Location.
| {% set routeReference = ibexa_route("ibexa.url.alias", { 'contentId': 456 }) %}
<p><a href="{{ ibexa_path(routeReference) }}">Route</a></p>
|
For cross-SiteAccess links, you can pass the parameter siteaccess
with a SiteAccess identifier.
| {% set routeReference = ibexa_route("ibexa.url.alias", { 'contentId': 456, 'siteaccess': 'shop' }) %}
<p><a href="{{ ibexa_path(routeReference) }}">Route</a></p>
|
With ibexa_route()
you can modify the route contained in RouteReference after creation, for example, by providing additional parameters:
| {% set routeReference = ibexa_route("ibexa.url.alias", { 'locationId': 2 }) %}
{% do routeReference.set("param", "param-value") %}
|
You can also use ibexa_route()
to create links to predefined routes, such as the ibexa.search
route that leads to a search form page:
| <a href="{{ ibexa_path(ibexa_route('ibexa.search')) }}">Search</a>
|
File download links
To provide a download link for a file, use ibexa_route()
with the ibexa_content_download
route:
| {% set download_route = ibexa_route('ibexa_content_download', {
'content': file,
'fieldIdentifier': 'file',
}) %}
<a href="{{ ibexa_path(download_route) }}">Download</a>
|
Route list
The following built-in routes are available for the front of the website.
Tip
To view all routes existing in the system, including internal and Back-Office related ones, run:
| php bin/console debug:router
|
Registration
Route name |
Path |
Description |
ibexa.user.user_register |
/user/register |
User registration form |
ibexa.user.register_confirmation ibexa.user.user_register_confirmation |
/register-confirm /user/register-confirm |
Confirmation page after user registration |
Login
Route name |
Path |
Description |
login |
/login |
Login form |
logout ibexa.commerce.customer.logout |
/logout /profile/logout |
Logging out the current user |
Profile
Route name |
Path |
Description |
ibexa.commerce.customer.detail |
/profile |
User profile |
ibexa.commerce.address.book.list |
/profile/address_book |
User address book |
Password
Route name |
Path |
Description |
ibexa.user_profile.change_password ibexa.commerce.password_change |
/user/change-password /change_password |
Form for password change |
ibexa.user.forgot_password |
/user/forgot-password |
Form for password resetting |
ibexa.user.forgot_password.migration |
/user/forgot-password/migration |
Form for resetting password after expiration |
ibexa.user.forgot_password.login |
/user/forgot-password/login |
Form for resetting password based on login instead of email address |
ibexa.user.reset_password |
/user/reset-password/{hashKey} |
Form for resetting password based on a generated link |
Content
Route name |
Path |
Description |
ibexa_content_download |
/content/download/{contentId}/{fieldIdentifier}/{filename} |
Downloading a binary file |
ibexa.content.create_no_draft |
/content/create/nodraft/{contentTypeIdentifier}/{language}/{parentLocationId} |
Creating a content item without using a draft |
ibexa.content.draft.edit |
/content/edit/draft/{contentId}/{versionNo}/{language}/{locationId} |
Editing a content item |
ibexa.content.draft.create |
/content/create/draft/{contentId}/{fromVersionNo}/{fromLanguage} |
Creating a new draft |
Search
Route name |
Path |
Description |
ibexa.search |
/search |
Search form |