Add Category Slug In Post Page

I am beginner in october cms and using rainlab blog plugin for my personal blog. I want to display category slug in the url of blog post page, how can i achieve that?




Should just be

Unless you skip the component all together there is no way around that. The Blog component for a post is just looking for the slug: :slug. I don't think you really have to worry about people changing the category in my opinion. Your post list page should have the url for its link. Why would a user change the category?

enter image description here

If you really care here is a way around that. Don't use the blog post component. Make your own plugin or use CMS Pages. The code will vary slightly and in this example I will use CMS Page code cause it is 'ad hoc' and quicker.

use Rainlab\Blog\Models\Post;
function onStart() {
    $category = $this->param('category');
    $slug = $this->param('slug');
    $posts = Post::whereHas('categories', function ($query) use ($category) {
            $query->where('slug', $category);
    $this['post'] = $posts->where('slug', $slug)->first();