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

defaultTitle not used on initial page load #507

Closed
tacomanator opened this issue Oct 5, 2020 · 4 comments
Closed

defaultTitle not used on initial page load #507

tacomanator opened this issue Oct 5, 2020 · 4 comments

Comments

@tacomanator
Copy link
Contributor

tacomanator commented Oct 5, 2020

Defining titleTemplate in a default config file works fine as I browse around the site. However, the first page load seems to ignore the template and display just the title as is. I create an example repository to demonstrate:

https://github.com/tacomanator/nextjs-nextseo-defaulttitle

Here is an animation of the problem. Notice how the title is missing "| MySite" initially, and on reload.

ezgif-3-8373ea0bf4ec

Note: I may be doing things a little differently. titleTemplate is defined, as per the website example titleTemplate: "%s | MySite", in a config file used by <DefaultSeo />. However, rather than using <NextSeo /> directly on each page, I use it on a shared Layout component, which receives and forward a title prop.

@modbender
Copy link

I had this problem before but I forgot how I solved it, I'm not sure but try putting DefaultSeo before Component in _app.js?

@tacomanator
Copy link
Contributor Author

tacomanator commented Oct 9, 2020

@modbender that did the trick thank you! Not sure if this should be considered working as is and maybe include a note in the docs about the order of DefaultSeo and Component, or as a bug?

@garmeeh
Copy link
Owner

garmeeh commented Oct 12, 2020

@tacomanator a pull request to add a note to the docs about this would be awesome 😅

DefaultSeo must come before Componentdue to the behavior of next internals.

@modbender
Copy link

I think it's about time this is closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants