TL;DR
When creating a post, set it's title to the slug you like and then publish it. You can change the title to the desired one later.
Check out the slug of this post ^ up there. Do you see it?
The slug should have been dev-protip-set-the-slug-of-your-posts
or something like that. But instead, it is dev-tip-set-slug
, which is much more readable. Here, I'll show you how to set the slugs of any post.
Note: This won't work for published posts. You have to do this when you create a new post or edit a draft.
-
Create a Post
-
Set the title of the post as the slug
-
Write your content and publish the post
You can continue writing your post's contents. Just make sure to not change the title. Once you finish, you can publish the post.
Now, the slug will be generated from the post title.
-
Fix the title
Now, you edit the post and set the proper title, then you can click
Save Changes
. The trick here is that if you edit the title, the slug will not be recalculated. -
Done!
You can continue making changes to the title, body and tags, but the slug will never change. This is supposed to be a bug, but it can be sort of useful.
If you want, you can view the post which I showed you in this post here
Top comments (0)