diff --git a/app/Http/Controllers/Microblog/HomeController.php b/app/Http/Controllers/Microblog/HomeController.php index 87b5d238d..43a497099 100644 --- a/app/Http/Controllers/Microblog/HomeController.php +++ b/app/Http/Controllers/Microblog/HomeController.php @@ -6,6 +6,7 @@ use Coyote\Http\Resources\MicroblogCollection; use Coyote\Http\Resources\MicroblogResource; use Coyote\Http\Resources\UserResource; +use Coyote\Microblog; use Coyote\Repositories\Eloquent\MicroblogRepository; use Coyote\Services\Microblogs; use Coyote\Services\Parser\Extensions\Emoji; @@ -63,7 +64,7 @@ public function show(int $id): View { $microblog = $this->builder->one($id); abort_if(!is_null($microblog->parent_id), 404); - $excerpt = excerpt($microblog->html); + $excerpt = $this->title($microblog); $this->breadcrumb->push($excerpt, route('microblog.view', [$microblog->id])); MicroblogResource::withoutWrapping(); $resource = new MicroblogResource($microblog); @@ -79,6 +80,15 @@ public function show(int $id): View ]); } + private function title(Microblog $microblog): string + { + $excerpt = excerpt($microblog->html); + if ($excerpt) { + return $excerpt; + } + return 'Wpis użytkownika: ' . $microblog->user->name; + } + private function tags(): array { $tags = $this->getCacheFactory()->remember('microblog:tags', 30 * 60, fn() => $this->microblog->getTags()); diff --git a/resources/views/layout.twig b/resources/views/layout.twig index 6ed34a108..817e8be57 100644 --- a/resources/views/layout.twig +++ b/resources/views/layout.twig @@ -16,7 +16,7 @@ {% endblock %} {% block head %} - {%- block title -%} :: 4programmers.net{%- endblock -%} + {% block title %} :: 4programmers.net{% endblock %} diff --git a/resources/views/microblog/view.twig b/resources/views/microblog/view.twig index 5db6768a3..2e7876616 100644 --- a/resources/views/microblog/view.twig +++ b/resources/views/microblog/view.twig @@ -1,9 +1,11 @@ {% extends 'layout' %} -{% block title %}{{ excerpt }}{{ parent() }}{% endblock %} + +{% block title %}{{ excerpt }} {{ parent() }}{% endblock %} {% block description %}{{ excerpt }}{% endblock %} {% block keywords %}{{ keywords(microblog.text)|join(',') }}{% endblock %} {% import 'components.meta' as meta %} + {% block meta_robots %} {{ meta.robots('index, follow') }} {{ parent() }} @@ -15,7 +17,7 @@ {% include 'microblog.aside' %} - +