Download the PHP package ntriga/pimcore-link-generator without Composer
On this page you can find all versions of the php package ntriga/pimcore-link-generator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ntriga/pimcore-link-generator
More information about ntriga/pimcore-link-generator
Files in ntriga/pimcore-link-generator
Package pimcore-link-generator
Short Description This is my package pimcore-link-generator
License MIT
Homepage https://github.com/ntriga/pimcore-link-generator
Informations about the package pimcore-link-generator
Easy link generator for Objects
Generate urls for objects using the NtrigaLinkGenerator.
The links will have this format:
Reasoning Behind URL Format
- Based on the ID, we can load the page a bit faster, which is important for UX and SEO.
- The length of the path has no importance for SEO, and the path is only used as an index. For this, we provide canonical URLs.
- In the SERP, the path is no longer displayed; instead, breadcrumbs are shown.
- The title/slug appears at the end of the path instead of the ID, making it clearer for the user.
Installation
You can install the package via composer:
Usage
Follow these steps to use the link generator.
Create property on the home document
Create a property on the home document of the type "document" that is inheritable.
This property will store the parent page of the object.
This makes it easy to link another document for each language.
E.g. "news_document"
Create an action with the correct annotation
Create an action that will be used to generate the link.
The annotation should be this format
Create LinkGenerator class for the object
Register the LinkGenerator as a service
Add the LinkGenerator as a service in your services.yaml file.
Create a twig extension
Create a twig extension that will be used to generate the link.
Register the twig extension as a service
Add the twig extension as a service in your services.yaml file.
Use the twig extension in your templates
Make sure the detail page contains a canonical link
With this strategy, the detail page will be accessible via multiple URLs. So it's important you set a canonical link on the detail page.
Additional features
Query parameters
You can add query parameters to the generated URL by passing them in the queryParams
array:
Changelog
Please see CHANGELOG for more information on what has changed recently.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- Vincent Bibauw
- All Contributors
License
The MIT License (MIT). Please see License File for more information.