Experimental project
This is a sandbox project, which contains experimental code for developer use only.
Synopsis
General
This module allows you to assign slugs to facet values for Entity Reference fields to replace the node ID in the URL.
Currently, when you have an Entityreference field as a facet, even when using Pretty Paths each facet value will be an NID, which is not very pretty. This module adds a new coder for Facet API Pretty Paths, along with an admin settings page, which allows you to create slugs for your reference facets!
Features
- Extends Facet API Pretty Paths by adding a custom Coder to provide SEO-friendly URLs for entityreference-based facets
- Fully configurable through the UI
- Only affects facets for which it is enabled
- Falls back to standard ID-based facet values if a slug cannot be found
Example
You have an "Industry" content type referenced by a node with Entityreference, and you have Search API set up with an 'Industry' facet. Using Pretty Paths, this module will turn this: search/path/industry/10
into this: search/path/industry/mining
Requirements
- Facet API
- Facet API Pretty Paths
- Entityreference (May also be compatible with other reference-type fields, and this module can be extended to support other field types easily)
Recommended modules
- Search API - Often used with Facet API to create views with facets
- Computed Field - A great way to create a slug field for your content types
- Pathauto - The pathauto_cleanstring function is especially helpful when creating slugs
Known problems
- Currently your slug field must be the same across any enabled facets. If you calculate your slugs differently for different content types, that logic will have to be in the slug field itself rather than being able to use different fields. It is planned to support a different field for each content type in each facet in the future.
- Currently only "node" entities are supported. Technically this should be able to work with any fieldable entity which is referenced by an Entityreference field, but the module at present hard-codes "node" as the entity type for simplicity. This could change in the future.
- Going to a separate settings page is a little bit less intuitive than enabling slugging per-facet on the facet display settings page itself. In the future this will be made simpler.
Pledges
None
Credits
- Ben McClure - bmcclure (https://drupal.org/user/278485)
Donations
I appreciate all donations!
My Gratipay Profile
Help wanted!
I am always looking for help maintaining projects. Contact me if interested!
Similar projects and how they are different
Facet API Pretty Paths, a requirement of this module, does almost the exact same thing for Taxonomy-based facets. This module is different in that it extends Pretty Paths to support slugs on a much wider array of facets--any node referenced by an Entityreference facet.
Dependencies
There are no external dependencies for this project. You must install the required modules, and have a slug field, and this module handles the rest.
Restrictions
None
Project information
- Project categories: Site search
- Created by replicaobscura on , updated
