Like many other in-person events, the Google Webmaster conferences were canceled due to the coronavirus pandemic.
But to ensure that people get their regular dose of SEO info, the tech giant brought its advocates together in a new video series called Webmaster Conference Lightning Talks. It’s a short version of the presentations that the Google advocates would have shared in the canceled conferences.
The talk series covers various topics, and Google intends to publish the videos throughout the year.
In its first episode, Martin Splitt explored the dos and don’ts of links and JavaScript in SEO.
Splitt points out that creating a link is not a straightforward process, especially when including JavaScript functionality to the link. Although Javascript can enable you to customize your links in various ways, it could also render the link unusable to crawlers.
So, what do you do?
The Right Ways to Apply JavaScript to Links for SEO
1. Keep Your Links Straightforward
Martin Splitt recommends the most straightforward methods of creating links. And that’s using the HTML tag with the destination URL in the ahref attribute.
You can also add JavaScript to a link to upgrade its functionality. However, it must meet specific conditions first.
2. Don’t Leave Out the Ahref Attribute
As tempting as it may be to remove the ahref attribute and “clean up” your code, don’t do it. According to Splitt, doing so means that the link will only work if the JavaScript also functions properly.
Crawlers can only access content using an ahref attribute. So if the attribute is absent, the bots will not be able to determine where a link goes to. Splitt also points out that it’s also a bad idea to add an ahref attribute with a pseudo URL.
3. Beware of Fragment Identifiers
You can distinguish a fragment identifier within a URL by the “#” symbol, and when it points to a subsection of a given page. For example, domainname.com/FAQ#subsection would take you to a specific point on the page domainname.com/FAQ.
Now, here’s the problem.
“Because fragments aren’t meant to point to different content, crawlers ignore them; they just pretend that the fragments don’t exist,” Splitt said
That means if you build a single page application using links full of fragment identifiers, crawlers will not follow the links.
Watch the full video here:
Comments (0)
Most Recent