Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SEO::title(...) missing after refresh / on inital pageload #470

Open
J87NL opened this issue Jul 6, 2023 · 7 comments
Open

SEO::title(...) missing after refresh / on inital pageload #470

J87NL opened this issue Jul 6, 2023 · 7 comments
Labels
needs more info Requires additional code example or logging

Comments

@J87NL
Copy link
Contributor

J87NL commented Jul 6, 2023

  • Laravel Version: 10.13.5
  • PHP Version: 8.2.7
  • Splade JS Version (npm): 1.4.15
  • Splade PHP Version (composer): 1.4.15

Description:

SEO::title(...)'s are working great when navigating through our Splade application using <Link's, but they dissapear after a page refresh and on the inital pageload.

Steps To Reproduce:

In my controllers I use

<?php

namespace App\Http\Controllers;

// ...
use ProtoneMedia\Splade\Facades\SEO;

class TestController extends Controller
{
    public function index()
    {
        SEO::title(__('A fancy title'));

        return view('index');
    }

When I navigate to this page using the menu the title is there, when I refresh it is gone.

@J87NL
Copy link
Contributor Author

J87NL commented Jul 24, 2023

Perhaps related: visiting a page from your local history sometimes opens the expected page (based on the title), sometimes a different one.

@ibrunotome
Copy link
Contributor

Anyone had found a way to fix this behavior?

@pascalbaljet
Copy link
Contributor

@J87NL which browser are you using? I can't seem to reproduce it on Chrome and Firefox.

@pascalbaljet pascalbaljet added the needs more info Requires additional code example or logging label Aug 3, 2023
@J87NL
Copy link
Contributor Author

J87NL commented Aug 3, 2023

Hi Pascal, thanks for your reply! I have this behavior in both Firefox 116.0 (64-bits) and Chrome 115.0.5790.110 (64-bits) on Ubuntu 22.04.2 LTS.

@ibrunotome
Copy link
Contributor

@pascalbaljet Are you testing with SSR enabled? I'm without ssr enabled and this happens both in local and production, chrome and safari.

@romain-lgr
Copy link

I had the same issue. Make sure you remove the <title> tag and have @spladeHead in your root.blade.php file.

@J87NL
Copy link
Contributor Author

J87NL commented Aug 28, 2023

Thanks @romain-lgr, you are right. This fixes the refresh-issue.

Not sure but I guess the <title>-tag is added when using https://github.com/protonemedia/laravel-splade-breeze starter kit.

However: this doesn't seem to fix the page history issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs more info Requires additional code example or logging
Projects
None yet
Development

No branches or pull requests

4 participants