Jump to content
Search Community

SplitText & Google SERP results conflict.

Saltbox test
Moderator Tag

Recommended Posts

Hi, everyone!

 

We've been using SplitText for almost all of the heading animations on our website for a long time and accidentally revealed the following issue.

 

It seems like Google is crawling our H1s instead of Title Tags on multiple pages and as a result— it is not able to read spans SplitText breaks headings into like a sentence.

Some of the pages where H1s and other headings are crawled instead of Meta Title and Description display them as separate letters separated by spaces in SERP.

 

Is there any fix possible for that? I don't think I can find similar topics on the forum.

 

Website link

I am also attaching multiple screenshots with the issue described.

 

Thanks in advance!

image (30).png

image (32).png

image (31).png

Screenshot 2024-02-28 at 3.04.20 PM.png

Link to comment
Share on other sites

That's really odd, google should be looking into your site on the server, before the JS is executed and SplitText did it's job, unless you're storing a pre-rendered version of your site in the server in that case google is doing what's supposed to.

 

Other than run SplitText's code in the client and upload a version without it to the server I can't think of something else, unless google is actually creating a fully rendered site that is also executing the JS scripts when is crawling through it.

 

I'm far from being an SEO expert so beyond this I can't really tell you , maybe this post by @Cassie can help:

 

Happy Tweening!

  • Like 1
Link to comment
Share on other sites

@Rodrigo @Cassie thank you very much for such a fast response!

 

Maybe it's a handful fact to mention: the website is done in Webflow.

 

So SplitText script is pasted into <head>, and animation is executed before </body> tag.

Could that be affecting it? Should I load SplitText script with defer maybe?

Link to comment
Share on other sites

@Rodrigo Sadly Webflow has character limits for scripts in their code and the SplitText script is overflowing in the section they have for before </body> scripts (that's why I dreeeeam about CDN links, haha). I will try to leave it in <head>, but add defer, so it loads the script after the DOM is formed and recrawl the links in GA. I will come back to you on that one.

 

Thanks once again!

Link to comment
Share on other sites

Hi,

 

What I meant is that you could leave SplitText in the head tag but move your custom JS code before the closing <body> tag, like that that particular code (that will run the SplitText logic) will run after the content is loaded.

 

Happy Tweening!

Link to comment
Share on other sites

  • 3 weeks later...

I'm curious if you tried putting your code into a DOMContentLoaded event handler. In other words, wait for the DOMContentLoaded event to fire before you execute the SplitText/GSAP code. 

document.addEventListener("DOMContentLoaded", () => {
  // your code here...
});

Worst case is maybe listen for the "load" event (which waits for images/assets to finish too). 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...