CodepadME / laravel-tricks

The source code for the Laravel Tricks website
http://laravel-tricks.com
MIT License
967 stars 297 forks source link

Post title change updates URL slug #43

Open chadwithuhc opened 10 years ago

chadwithuhc commented 10 years ago

I think it would be better if the URL slug did not update with the title of the post. If a user posts a trick, then later on changes the title, the anyone linked to that page will break.

I propose one of a few options:

  1. Disable updating or URL slug. Once it's created, it's set (This could be seen as a bad feature though)
  2. Use a unique ID of some kind instead (I think this was mentioned elsewhere...)
  3. Somehow keep track of the changes and have a redirect to the new URL (This could be overkill)

Thoughts?

stidges commented 10 years ago

I think the second option would be best. But I kind of like to keep the URLs readable. We should think of a way to combine the two. Maybe something like /tricks/<id>/<slug>, where the slug is just as a 'readable detail' and the tricks get retrieved by the given ID?

chadwithuhc commented 10 years ago

I think that is doable. I've always wondered, what do people think is the best solution for situations where someone tries to visit the URL without the slug, like /tricks/<id>? Do they just redirect them to the full URL to prevent duplicate pages, or give em a 404?

stidges commented 10 years ago

Hmm that's tough, I'd rather prevent that extra request / redirect..

chadwithuhc commented 10 years ago

I agree, but the only reason they would get there is a bad link or trying to break the URL anyway... so it's not a common occurrence.

stidges commented 10 years ago

You're right. I'll look into the options and see if I can implement a change :)