Skip to content

Commit

Permalink
Add page number to page title in authors and collections landing [WEB…
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhiltri committed Jan 10, 2025
1 parent d0e0d0c commit d409d2b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
7 changes: 5 additions & 2 deletions app/Http/Controllers/AuthorController.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ public function index(Request $request)
$items = $this->repository->published()->ordered()->paginate();

$title = 'Authors';
$titles = array_filter([
$title,
request('page') ? 'Page ' . request('page') : null,
]);
$this->seo->setTitle(implode(', ', $titles));

$subNav = [
['label' => $title, 'href' => route('authors.index'), 'active' => true]
Expand All @@ -30,8 +35,6 @@ public function index(Request $request)
['label' => 'Publications', 'href' => route('articles_publications'), 'links' => $subNav]
];

$this->seo->setTitle($title);

$view_data = [
'title' => $title,
'subNav' => $subNav,
Expand Down
11 changes: 9 additions & 2 deletions app/Http/Controllers/CollectionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,16 @@ public function index()
$activeFilters = $this->collection()->activeFilters();

if ($activeFilters->count()) {
$this->seo->setTitle(implode(', ', $activeFilters->pluck('label')->all()));
$titles = $activeFilters->pluck('label')->all();
$titles[] = request('page') ? 'Page ' . request('page') : null;
$titles = array_filter($titles);
$this->seo->setTitle(implode(', ', $titles));
} else {
$this->seo->setTitle('Discover Art & Artists');
$titles = array_filter([
'Discover Art & Artists',
request('page') ? 'Page ' . request('page') : null,
]);
$this->seo->setTitle(implode(', ', $titles));
}

if ($collection->count()) {
Expand Down

0 comments on commit d409d2b

Please sign in to comment.