Sign in
Log inSign up

How do you handle slug-based routing, but translatable entities that have an empty slug at first? Which breaks..

Miguel Stevens's photo
Miguel Stevens
·Apr 15, 2019

I'm using slug-based routing, like this

myapp.com/posts/first-post

I have a Post entity, and a PostTranslation entity, When I create a Post entity, 2 PostTranslation entities are being created (for each language), and they have an empty slug and title field, so the user can choose this. The issue is that when I want to browse to this post, and the user didn't set a slug yet, it will break. How would you handle this?

Hassle-free blogging platform that developers and teams love.
  • Docs by Hashnode
    New
  • Blogs
  • AI Markdown Editor
  • GraphQL APIs
  • Open source Starter-kit

© Hashnode 2024 — LinearBytes Inc.

Privacy PolicyTermsCode of Conduct