问题列表seo设置方法如下:
1、控制器获取当前分类对象
$parentId=$currentCategoryId = 0;
$currentCategory = null;
if( $categorySlug != 'all' ){
$category = Category::where("slug","=",$categorySlug)->first();
$currentCategory = $category;
if(!$category){
abort(404);
}
$currentCategoryId = $category->id;
$parentId = $category->parent_id;
if($category->hasChild()){
$parentId = $category->id;
}
}
return view('theme::home.ask')->with(compact('currentCategory','questions','hotUsers','hotTags','filter','categories','currentCategoryId','parentId','parentCategories','categorySlug'));
@if($currentCategory) $currentCategory->name @endif
如果觉得我的回答对您有用,请随意打赏。你的支持将鼓励我继续创作!