# norman/friendly_id

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/norman-friendly-id).**

6,225 stars · 589 forks · Ruby · MIT

## Links

- GitHub: https://github.com/norman/friendly_id
- Homepage: http://norman.github.io/friendly_id/
- awesome-repositories: https://awesome-repositories.com/repository/norman-friendly-id.md

## Topics

`friendly-url` `plugin` `rails` `ruby` `slug`

## Description

Friendly ID is an ActiveRecord slugging plugin that generates human-readable URL slugs from model attributes, replacing numeric IDs for cleaner permalinks in Rails applications. It resolves database records by matching a slug string instead of the numeric primary key in finder methods, enabling friendlier URLs throughout an application.

The plugin provides a slug conflict resolution system that appends a UUID or uses candidate attribute combinations to guarantee unique slugs when the primary choice is already taken. It also offers a scoped uniqueness engine that restricts slug uniqueness within a defined association or foreign key, allowing duplicate slugs across different parent records. A permalink history tracker records previous slugs for a record and redirects old URLs to the current one, preserving link integrity after slug changes. Additionally, it includes a reserved word filter that prevents specified terms from being used as slugs, avoiding conflicts with application routes or reserved paths, and provides multilingual slug support that stores and resolves different slug translations per locale.

The project covers slug generation from model attributes, candidate-based conflict resolution with prioritized fallback attribute combinations, and customizable slug generation logic through a custom generator hook. It also supports locale-specific slug translation, scoped uniqueness constraints, and history-aware redirect chains that issue HTTP redirects when outdated slugs are requested.

## Tags

### Web Development

- [Slug Generators](https://awesome-repositories.com/f/web-development/url-generators/slug-generators.md) — Generates human-readable URL slugs from model attributes, replacing numeric IDs for cleaner permalinks in Rails applications. ([source](https://cdn.jsdelivr.net/gh/norman/friendly_id@master/README.md))
- [Slug History Redirects](https://awesome-repositories.com/f/web-development/http-redirects/slug-history-redirects.md) — Stores previous slug versions and issues HTTP redirects when outdated slugs are requested.
- [Slug-Based](https://awesome-repositories.com/f/web-development/request-redirections/slug-based.md) — Compares the request path to the current slug and issues a 301 redirect when they differ. ([source](https://norman.github.io/friendly_id/FriendlyId/History.html))
- [Historical Slug Redirects](https://awesome-repositories.com/f/web-development/url-generators/slug-generators/automated-slug-synchronization/historical-slug-redirects.md) — Redirects requests to a model's current slug when accessed via an older, stored slug. ([source](https://norman.github.io/friendly_id/FriendlyId/History.html))
- [History Tracking](https://awesome-repositories.com/f/web-development/url-generators/slug-generators/automated-slug-synchronization/history-tracking.md) — Stores previous slugs for a record so old permalinks continue to resolve after slug changes. ([source](https://cdn.jsdelivr.net/gh/norman/friendly_id@master/README.md))
- [Slug History Resolutions](https://awesome-repositories.com/f/web-development/url-generators/slug-generators/automated-slug-synchronization/slug-history-resolutions.md) — Stores a log of every slug a record has ever used so old URLs continue to resolve after changes. ([source](https://norman.github.io/friendly_id/FriendlyId/History.html))
- [Slug History Trackers](https://awesome-repositories.com/f/web-development/url-generators/slug-generators/automated-slug-synchronization/slug-history-trackers.md) — Records all previous slugs for a record so old URLs continue to resolve correctly after changes. ([source](https://cdn.jsdelivr.net/gh/norman/friendly_id@master/README.md))
- [Candidate Chains](https://awesome-repositories.com/f/web-development/url-generators/slug-generators/candidate-chains.md) — Provides prioritized fallback attribute combinations to generate unique slugs when the primary choice is taken. ([source](https://norman.github.io/friendly_id/))
- [Conflict Resolution](https://awesome-repositories.com/f/web-development/url-generators/slug-generators/conflict-resolution.md) — Ensures unique slugs by appending UUIDs or using candidate fallback attributes when the primary slug is taken.
- [Conflict Resolution Strategies](https://awesome-repositories.com/f/web-development/url-generators/slug-generators/conflict-resolution-strategies.md) — Provides a conflict resolution system that appends UUIDs or uses candidate attributes to guarantee unique slugs.
- [Custom Slug Configurations](https://awesome-repositories.com/f/web-development/url-generators/slug-generators/custom-slug-configurations.md) — Allows users to define custom slug-building logic by replacing the default generator with a user-defined hook.
- [Scoped Slug Uniqueness Constraints](https://awesome-repositories.com/f/web-development/url-generators/slug-generators/custom-slug-configurations/scoped-slug-uniqueness-constraints.md) — Restricts slug uniqueness within a defined association or foreign key, allowing duplicates across scopes. ([source](https://cdn.jsdelivr.net/gh/norman/friendly_id@master/README.md))
- [Slug History Redirects](https://awesome-repositories.com/f/web-development/url-generators/slug-generators/custom-slug-configurations/slug-history-redirects.md) — Logs previous slugs and redirects requests for outdated identifiers to the current slug. ([source](https://norman.github.io/friendly_id/file.Guide.html))
- [History Redirects](https://awesome-repositories.com/f/web-development/url-generators/slug-generators/history-redirects.md) — Tracks previous slugs and automatically redirects old URLs to current records to prevent broken links.
- [History Trackers](https://awesome-repositories.com/f/web-development/url-generators/slug-generators/history-trackers.md) — Records previous slugs for a record and redirects old URLs to the current one, preserving link integrity.
- [History Tracking & Redirects](https://awesome-repositories.com/f/web-development/url-generators/slug-generators/history-tracking-redirects.md) — Tracks previous slugs and redirects old URLs to the current one, preserving link integrity after slug changes.
- [Scoped Uniqueness](https://awesome-repositories.com/f/web-development/url-generators/slug-generators/scoped-uniqueness.md) — Generates unique slugs within a defined scope, allowing the same slug to exist under different parent records. ([source](https://cdn.jsdelivr.net/gh/norman/friendly_id@master/README.md))
- [Locale-Specific Slug Translations](https://awesome-repositories.com/f/web-development/url-generators/slug-generators/automated-slug-synchronization/locale-specific-slug-translations.md) — Stores and resolves different slug translations per locale for multilingual URL support. ([source](https://norman.github.io/friendly_id/file.Guide.html))
- [Candidate-Based Slug Conflict Resolvers](https://awesome-repositories.com/f/web-development/url-generators/slug-generators/candidate-based-slug-conflict-resolvers.md) — Defines a prioritized list of alternate attribute combinations to generate a unique slug when the primary choice is taken. ([source](https://norman.github.io/friendly_id/))
- [Fallback Slug Candidate Lists](https://awesome-repositories.com/f/web-development/url-generators/slug-generators/custom-slug-configurations/fallback-slug-candidate-lists.md) — Specifies a list of fallback slug sources to use when the primary slug is already taken. ([source](https://norman.github.io/friendly_id/file.Guide.html))
- [Reserved Word Filters](https://awesome-repositories.com/f/web-development/url-generators/slug-generators/custom-slug-configurations/reserved-word-filters.md) — Prevents specified terms from being used as slugs, avoiding conflicts with application routes or reserved paths. ([source](https://cdn.jsdelivr.net/gh/norman/friendly_id@master/README.md))
- [Locale-Specific](https://awesome-repositories.com/f/web-development/url-generators/slug-generators/locale-specific.md) — Generates and resolves slugs per locale, enabling multilingual URL paths for the same record. ([source](https://cdn.jsdelivr.net/gh/norman/friendly_id@master/README.md))
- [Locale-Specific Slug Translations](https://awesome-repositories.com/f/web-development/url-generators/slug-generators/locale-specific-slug-translations.md) — Stores separate slug translations per locale and resolves the correct slug based on the current locale.
- [Multilingual Slugs](https://awesome-repositories.com/f/web-development/url-generators/slug-generators/multilingual-slugs.md) — Manages locale-specific slug translations so records have different friendly URLs per language.
- [Reserved Word Filters](https://awesome-repositories.com/f/web-development/url-generators/slug-generators/reserved-word-filters.md) — Prevents specified terms from being used as slugs, avoiding conflicts with application routes or reserved paths.
- [Reserved Word Prevention](https://awesome-repositories.com/f/web-development/url-generators/slug-generators/reserved-word-prevention.md) — Blocks specified terms from being used as slugs to avoid conflicts with application routes or reserved paths.
- [Scoped Slug Uniqueness Constraints](https://awesome-repositories.com/f/web-development/url-generators/slug-generators/scoped-slug-uniqueness-constraints.md) — Restricts slug uniqueness within a defined association, allowing duplicate slugs across different parent records. ([source](https://norman.github.io/friendly_id/file.Guide.html))
- [Slug Uniqueness Enforcers with Fallbacks](https://awesome-repositories.com/f/web-development/url-generators/slug-generators/slug-uniqueness-enforcers-with-fallbacks.md) — Appends a UUID to duplicate slugs and supports candidate slugs as alternatives for uniqueness. ([source](https://norman.github.io/friendly_id/file.Guide.html))
- [UUID-Based Slug Uniqueness Enforcers](https://awesome-repositories.com/f/web-development/url-generators/slug-generators/uuid-based-slug-uniqueness-enforcers.md) — Appends a UUID to duplicate slugs to guarantee uniqueness for each record. ([source](https://norman.github.io/friendly_id/file.Guide.html))

### Content Management & Publishing

- [AI Q&A Dialogue Generators](https://awesome-repositories.com/f/content-management-publishing/q-a-content-strategies/ai-q-a-dialogue-generators.md) — Creates a human-readable URL string from a database record's attribute, replacing the numeric primary key. ([source](https://cdn.jsdelivr.net/gh/norman/friendly_id@master/README.md))

### Data & Databases

- [Scoped Slug Uniqueness Constraints](https://awesome-repositories.com/f/data-databases/data-management/unique-identifier-generators/uniqueness-enforcement/scoped-slug-uniqueness-constraints.md) — Enforces slug uniqueness within a configurable association or foreign key scope.
- [Slug-Based Record Retrieval](https://awesome-repositories.com/f/data-databases/database-record-querying/slug-based-record-retrieval.md) — Resolves database records by matching a human-readable slug string instead of the numeric primary key.
- [Slug History Trackers](https://awesome-repositories.com/f/data-databases/database-record-querying/slug-based-record-retrieval/slug-history-trackers.md) — Stores a record of all previous slugs for a model, allowing old URLs to redirect or resolve. ([source](https://cdn.jsdelivr.net/gh/norman/friendly_id@master/README.md))
- [Slug Reserved Word Filters](https://awesome-repositories.com/f/data-databases/sql-reserved-word-handling/slug-reserved-word-filters.md) — Prevents specified terms from being used as slugs by checking against a configurable blacklist.

### Software Engineering & Architecture

- [Slug Conflict Resolutions](https://awesome-repositories.com/f/software-engineering-architecture/data-sync-conflict-resolution/list-conflict-resolution/slug-conflict-resolutions.md) — Provides a prioritized list of fallback attribute combinations to guarantee unique slugs on conflict.

### Development Tools & Productivity

- [Fallback Lookups](https://awesome-repositories.com/f/development-tools-productivity/workspace-management/project-workspaces/workspace-organization/workspace-listings/slug-based-lookups/fallback-lookups.md) — Finds records by slug while falling back to numeric ID lookup when the slug is not found. ([source](https://norman.github.io/friendly_id/))
