Skip to content

fix: unify slug generation logic to fix hydration mismatches#150

Open
moshe690 wants to merge 1 commit intoshayaulman:masterfrom
moshe690:fix/slugify-category-paths
Open

fix: unify slug generation logic to fix hydration mismatches#150
moshe690 wants to merge 1 commit intoshayaulman:masterfrom
moshe690:fix/slugify-category-paths

Conversation

@moshe690
Copy link

Description

The root cause of the 404 errors was inconsistent URL handling across the app (the server generated paths with spaces, while the client router expected encoded URLs).

Instead of patching each component individually, I introduced a centralized utility src/utils/slugify.js.

Changes

  • Created src/utils/slugify.js (CommonJS compatible).
  • Updated gridsome.server.js and client components (TechCard, VideoCard, etc.) to use the utility.
  • Added support for special characters (e.g., C++, C#).

Benefits / Why this is better

  1. DRY: Removes duplicate regex logic from 5 different files.
  2. Consistency: Ensures server-side generation and client-side routing are synced.
  3. Robustness: Fixes the space issue and handles special chars cleanly.

- Created src/utils/slugify.js (CommonJS) to centralize slug logic.
- Updated server and client components to use consistent paths.
- Added support for special chars (C++, C#) and fixed 404s on refresh.
@netlify
Copy link

netlify bot commented Feb 16, 2026

👷 Deploy request for koshercode pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit e6c553d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant