Adding Book Name to the Title - SEO #1657

Closed
opened 2026-02-05 01:31:58 +03:00 by OVERLORD · 3 comments
Owner

Originally created by @venkat0304 on GitHub (Apr 16, 2020).

Hi, Is there any way to add Book title name to the title meta tag ?

Expecting something like - |

base.blade.php

<!DOCTYPE html>
<html lang="{{ config('app.lang') }}" class="@yield('body-class')">
<head>
    <title>{{ isset($pageTitle) ? $pageTitle . ' | ' : '' }}{{ setting('app-name') }}</title>
    <!-- Meta -->

Originally created by @venkat0304 on GitHub (Apr 16, 2020). Hi, Is there any way to add Book title name to the title meta tag ? Expecting something like <Bookname> - <Pagetitle> | <websitename> base.blade.php ``` <!DOCTYPE html> <html lang="{{ config('app.lang') }}" class="@yield('body-class')"> <head> <title>{{ isset($pageTitle) ? $pageTitle . ' | ' : '' }}{{ setting('app-name') }}</title> <!-- Meta --> ```
OVERLORD added the :cat2:🐈 Possible duplicate label 2026-02-05 01:31:58 +03:00
Author
Owner

@venkat0304 commented on GitHub (Apr 16, 2020):

{{ $book->name }} -> adding this works on books page but shelves page is giving 500 error.

@venkat0304 commented on GitHub (Apr 16, 2020): {{ $book->name }} -> adding this works on books page but shelves page is giving 500 error.
Author
Owner

@LouWii commented on GitHub (Apr 22, 2020):

Have you tried something like {{ isset($book) ? $book->name : '' }}

@LouWii commented on GitHub (Apr 22, 2020): Have you tried something like `{{ isset($book) ? $book->name : '' }}`
Author
Owner

@ssddanbrown commented on GitHub (Apr 25, 2020):

Hi @venkat0304,
This is not possible without altering the core BookStack files.

If you do want to make changes to the core files, using the code @LouWii has advised should work to get the book name if it exists. Alternatively you could shorten this to `{{ $book->name ?? '' }}``.
As another option, This is where the title for a page is set:

79a949836b/app/Http/Controllers/PageController.php (L148)

Since this request is already open under #1604, With #1682 being very much related, I'm going to close this off as a duplicate.

@ssddanbrown commented on GitHub (Apr 25, 2020): Hi @venkat0304, This is not possible without altering the core BookStack files. If you do want to make changes to the core files, using the code @LouWii has advised should work to get the book name if it exists. Alternatively you could shorten this to `{{ $book->name ?? '' }}``. As another option, This is where the title for a page is set: https://github.com/BookStackApp/BookStack/blob/79a949836b93c89b5efd9d9cf94e0f2b93dda48f/app/Http/Controllers/PageController.php#L148 Since this request is already open under #1604, With #1682 being very much related, I'm going to close this off as a duplicate.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#1657