The module contains a field type which provides 1:1 reflection of "path" property (defined in entities to determine their human-readable URL alias).
Why would I need "path" property as a field?
Some headless Drupal successors (like JSON API) do not provide a way to filter entities by "path" property due to technical limitations (See #2799909: [BUGFIX] Return the alias and allow filtering on it).
It means that if you'd want to implement a dynamic routing from your frontend application (something more human-readable than just /article/[id]) then your app has to know which entity to render when an end user hits /article/[path] page. So far the only way to achieve this is to filter entities by path stored as a field.
Usage
- Install the module as usual
- Add "Fieldable Path" field to your entity through "Manage fields" page
- Create or update any entity
Now you can do the following (assuming you've added the field to "article" node with name "field_path"):
GET http://{host}/jsonapi/node/article?filter[field_path][value]=/my-article
Note that Pathauto is supported, so you can get all power of Drupal to generate human-readable aliases for your frontend application.
What to do if your site already has some content?
The module includes an action which clones path property to the field in a bulk mode. To find it, go to the node / user list page, select necessary items and pick "Copy path to Fieldable Path field" in the action selection dropdown.
Project information
- Minimally maintained
Maintainers monitor issues, but fast responses are not guaranteed. - Maintenance fixes only
Considered feature-complete by its maintainers. - Module categories: Site Structure, Administration Tools, Integrations
- 2,918 sites report using this module
- Created by Spleshka on , updated
- Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.
Releases
Development version: 8.x-1.x-dev updated 3 Apr 2023 at 16:07 UTC