Course Overview
Locked video preview

Paid video

Please purchase the course to watch.

Building the article view

Slugs and human readable URLs

Here is a summary of the video transcript:

  • Purpose of Slugs
    Slugs replace numeric IDs in URLs to improve SEO, readability, and shareability. They create stable, human-readable links and improve analytics visibility by clearly identifying content.

  • Database Migration
    A new migration adds a slug column to the articles table, with corresponding rollback logic. Migrations are reset and reapplied to ensure the schema aligns with seeded data.

  • Model and Query Updates
    The article model is updated to include a slug field. A slug-generation library converts article titles into URL-friendly strings during creation, and database queries are regenerated accordingly.

  • Seeding and Database Reset
    Existing seed data is regenerated after resetting migrations to ensure all records include valid slug values. This ensures consistency between schema and data.

  • Routing and Controller Refactor
    Routes are updated to use slug instead of id as the URL parameter. A new model function retrieves articles by slug, and controllers are modified to use this lookup.

  • Final Result and Next Steps
    The application successfully serves articles using human-readable URLs. The next step introduces Markdown processing and converting Markdown content into styled HTML.