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

LCP preload won't be added to a page if there is a space in the closing title tag #6323

Closed
vmanthos opened this issue Dec 12, 2023 · 0 comments · Fixed by #6324
Closed

LCP preload won't be added to a page if there is a space in the closing title tag #6323

vmanthos opened this issue Dec 12, 2023 · 0 comments · Fixed by #6324
Assignees
Milestone

Comments

@vmanthos
Copy link
Contributor

Before submitting an issue please check that you’ve completed the following steps:

  • Made sure you’re on the latest version ✔️
  • Used the search feature to ensure that the bug hasn’t been reported before ✔️

Describe the bug

We rely on detecting </title> to add preloaded LCP on a page:
https://github.com/wp-media/wp-rocket/blob/9e73f9473c9c5a3d194ad87564eafe43438d3fea/inc/Engine/Media/AboveTheFold/Frontend/Controller.php

If instead of </title> the theme adds </title >, which is still valid, we won't add the code to preload the LCP to the page.

That kind of scenario would be possible for themes that don't use add_theme_support( 'title-tag' ); and are adding the <title></title> on their own, or for specific templates.

To Reproduce
Steps to reproduce the behavior:

  1. Use the following template to create a page: https://github.com/wp-media/rocket-test-data/blob/master/templates/title_tag_with_space.php
  2. After LCP has been processed by the SaaS check the source code of the page.
  3. The LCP image will not be preloaded.

Expected behavior

We should be able to correctly append the preloaded LCP to </title >.

Additional context

N/A

Acceptance Criteria (for WP Media team use only)
Clear instructions for developers, to be added before the grooming

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

Successfully merging a pull request may close this issue.

3 participants