Skip to content

Commit d1892ab

Browse files
committed
Fix seo tag page view + controller bug
1 parent 9fcfad5 commit d1892ab

File tree

2 files changed

+83
-75
lines changed

2 files changed

+83
-75
lines changed
Lines changed: 82 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,92 @@
1-
@extends('filament-flexible-content-block-pages::tailwind.components.layouts.base')
1+
<x-flexible-pages-base-layout wide="true">
2+
<header>
3+
<x-flexible-pages-language-switch/>
4+
</header>
25

3-
@section('content')
4-
<div class="container mx-auto px-6 py-8">
5-
<div class="mb-8">
6-
<h1 class="text-3xl font-bold mb-4">
7-
{{ $tag->getTranslation('name', app()->getLocale()) }}
8-
</h1>
6+
<main class="prose-headings:font-base">
7+
<div class="container mx-auto px-6 py-8">
8+
<div class="mb-8">
9+
<h1 class="text-3xl font-bold mb-4">
10+
{{ $tag->getTranslation('name', app()->getLocale()) }}
11+
</h1>
912

10-
@if($tag->seo_description)
11-
<p class="text-lg text-gray-600 mb-6">
12-
{{ $tag->getTranslation('seo_description', app()->getLocale()) }}
13-
</p>
14-
@endif
13+
@if($tag->seo_description)
14+
<p class="text-lg text-gray-600 mb-6">
15+
{{ $tag->getTranslation('seo_description', app()->getLocale()) }}
16+
</p>
17+
@endif
1518

16-
@if($contentCounts && count($contentCounts) > 0)
17-
<div class="flex flex-wrap gap-2 mb-6">
18-
@foreach($contentCounts as $type => $count)
19-
<span class="px-3 py-1 bg-gray-100 rounded-full text-sm">
20-
{{ $count }} {{ $type }}
21-
</span>
22-
@endforeach
19+
@if($contentCounts && count($contentCounts) > 0)
20+
<div class="flex flex-wrap gap-2 mb-6">
21+
@foreach($contentCounts as $type => $count)
22+
<span class="px-3 py-1 bg-gray-100 rounded-full text-sm">
23+
{{ $count }} {{ $type }}
24+
</span>
25+
@endforeach
26+
</div>
27+
@endif
2328
</div>
24-
@endif
25-
</div>
2629

27-
@if($taggedContent->count() > 0)
28-
<div class="space-y-6">
29-
@foreach($taggedContent as $item)
30-
<article class="border-b border-gray-200 pb-6 last:border-b-0">
31-
<div class="flex justify-between items-start mb-2">
32-
<span class="text-sm text-blue-600 font-medium uppercase">
33-
{{ $modelLabels[$item::class] ?? class_basename($item) }}
34-
</span>
35-
@if(method_exists($item, 'publishing_begins_at') && $item->publishing_begins_at)
36-
<time class="text-sm text-gray-500">
37-
{{ $item->publishing_begins_at->format('M j, Y') }}
38-
</time>
39-
@endif
40-
</div>
30+
@if($taggedContent->count() > 0)
31+
<div class="space-y-6">
32+
@foreach($taggedContent as $item)
33+
<article class="border-b border-gray-200 pb-6 last:border-b-0">
34+
<div class="flex justify-between items-start mb-2">
35+
<span class="text-sm text-blue-600 font-medium uppercase">
36+
{{ $modelLabels[$item::class] ?? class_basename($item) }}
37+
</span>
38+
@if(method_exists($item, 'publishing_begins_at') && $item->publishing_begins_at)
39+
<time class="text-sm text-gray-500">
40+
{{ $item->publishing_begins_at->format('M j, Y') }}
41+
</time>
42+
@endif
43+
</div>
4144

42-
<h2 class="text-xl font-semibold mb-2">
43-
@if(method_exists($item, 'getUrl'))
44-
<a href="{{ $item->getUrl() }}" class="hover:text-blue-600">
45-
{{ $item->title }}
46-
</a>
47-
@else
48-
{{ $item->title }}
49-
@endif
50-
</h2>
45+
<h2 class="text-xl font-semibold mb-2">
46+
@if(method_exists($item, 'getUrl'))
47+
<a href="{{ $item->getUrl() }}" class="hover:text-blue-600">
48+
{{ $item->title }}
49+
</a>
50+
@else
51+
{{ $item->title }}
52+
@endif
53+
</h2>
5154

52-
@if(method_exists($item, 'intro') && $item->intro)
53-
<p class="text-gray-600 mb-3">
54-
{{ Str::limit(strip_tags($item->intro), 200) }}
55-
</p>
56-
@endif
55+
@if(method_exists($item, 'intro') && $item->intro)
56+
<p class="text-gray-600 mb-3">
57+
{{ Str::limit(strip_tags($item->intro), 200) }}
58+
</p>
59+
@endif
5760

58-
@if(method_exists($item, 'tags') && $item->tags->count() > 0)
59-
<div class="flex flex-wrap gap-1">
60-
@foreach($item->tags->take(5) as $itemTag)
61-
<span class="px-2 py-1 bg-gray-50 rounded text-xs text-gray-700">
62-
{{ $itemTag->getTranslation('name', app()->getLocale()) }}
63-
</span>
64-
@endforeach
65-
</div>
66-
@endif
67-
</article>
68-
@endforeach
69-
</div>
61+
@if(method_exists($item, 'tags') && $item->tags->count() > 0)
62+
<div class="flex flex-wrap gap-1">
63+
@foreach($item->tags->take(5) as $itemTag)
64+
<span class="px-2 py-1 bg-gray-50 rounded text-xs text-gray-700">
65+
{{ $itemTag->getTranslation('name', app()->getLocale()) }}
66+
</span>
67+
@endforeach
68+
</div>
69+
@endif
70+
</article>
71+
@endforeach
72+
</div>
7073

71-
@if($taggedContent->hasPages())
72-
<div class="mt-8">
73-
{{ $taggedContent->links() }}
74-
</div>
75-
@endif
76-
@else
77-
<div class="text-center py-12">
78-
<p class="text-gray-600 text-lg">
79-
@lang('filament-flexible-content-block-pages::tag_pages.no_content', ['tag' => $tag->getTranslation('name', app()->getLocale())])
80-
</p>
74+
@if($taggedContent->hasPages())
75+
<div class="mt-8">
76+
{{ $taggedContent->links() }}
77+
</div>
78+
@endif
79+
@else
80+
<div class="text-center py-12">
81+
<p class="text-gray-600 text-lg">
82+
@lang('filament-flexible-content-block-pages::tag_pages.no_content', ['tag' => $tag->getTranslation('name', app()->getLocale())])
83+
</p>
84+
</div>
85+
@endif
8186
</div>
82-
@endif
83-
</div>
84-
@endsection
87+
</main>
88+
89+
<footer>
90+
<div>{{flexiblePagesSetting(Settings::SETTING_FOOTER_COPYRIGHT)}}</div>
91+
</footer>
92+
</x-flexible-pages-base-layout>

src/Http/Controllers/SeoTagController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function __construct(
2323
public function index(Tag $tag): View
2424
{
2525
// Return not found when tag pages are not enabled
26-
if (FilamentFlexibleContentBlockPages::config()->areTagPagesEnabled()) {
26+
if (! FilamentFlexibleContentBlockPages::config()->areTagPagesEnabled()) {
2727
abort(404);
2828
}
2929

0 commit comments

Comments
 (0)