Yoast SEO metadata not updating during AJAX project navigation
-
Yoast SEO metadata not updating during AJAX project navigation
Hi Armin,
While testing the SEO implementation of my new portfolio website, I noticed an inconsistency in how Yoast SEO metadata is handled during AJAX navigation.
Environment:
- Operating System: macOS 27.2.1
- Browser: Google Chrome 158.0.8127.108 (Official Build, arm64)
- Lay Theme: 12.0.2
- WordPress: 7.1.5
- Yoast SEO: 28.9
- PHP: 8.4
- LiteSpeed Cache
- Hosting: Namecheap
The website is currently under development in a staging environment protected by Basic Authentication and a sitewide
noindexdirective.Steps to reproduce:
- Open a page containing a Project Grid.
- Click on a project without manually refreshing the browser.
- Inspect the document head using Chrome DevTools.
Expected behaviour:
All SEO metadata and structured data should reflect the currently displayed project after AJAX navigation.
Actual behaviour:
The URL, page content and document title update correctly. However, the following elements either remain associated with the previous page or are missing:
- Meta description
- Open Graph title
- Open Graph URL
- Open Graph image
- Yoast JSON-LD structured data
After a hard refresh or when accessing the project URL directly, all metadata and structured data are correctly generated.
Troubleshooting already performed:
- Purged all LiteSpeed caches.
- Cleared the Lay Theme Layout Cache.
- Repeated the tests in a fresh Chrome Incognito session.
- Temporarily deactivated the LiteSpeed Cache plugin entirely.
The issue persists in all these scenarios.
Is this a known limitation of Lay Theme's AJAX navigation when using Yoast SEO? Is there an existing setting, hook or recommended approach to synchronise the SEO metadata during page transitions?
Ideally, I would like to preserve AJAX navigation and the existing page transitions while ensuring that the document head accurately represents the current page.
I've attached screenshots illustrating the behaviour before and after a hard refresh.
Thanks in advance for your help!
Best regards,
João Loureiro
https://joaoloureiro.com -
Quick update: Yoast SEO has just been updated from version 28.9 to 29.0. I've repeated the same tests after clearing both the LiteSpeed and Lay Theme caches, and can confirm that the issue persists.
Direct page loads continue to generate the correct metadata and structured data, but AJAX project navigation still leaves the previous page's metadata in the document head.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login