SPAs & PWAs are challenging for SEO for a number of reasons, this checklist is what I’ve seen issues arise with-
- Google Analytics
- JavaScript History API & URLs
- Soft 404s
- JavaScript links
- Heavy code & assets on first load
- No metadata for Facebook Twitter and other sharing platforms.
- Spider traps & loops
- Duplicate Content
- Tracking parameters causing issues
- Fragments, or Hashbangs
- No sitemap
Although this list isn’t exhaustive, it is the main issues that crop up that aren’t expected, as with everything in SEO, the more that it can be tested, the more likely it is that issues are spotted earlier.
6. OK WTF isn’t a spa
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>A Heading</h1>
<p>Some test.</p>
<a href=“/NewURL/”> another page </a>
</body>
</html>
@dergal
7. A link goes to another page
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>A Heading</h1>
<p>Some test.</p>
<a href=“/anotherpage/”> another page
</a>
</body>
</html>
@dergal
8. Then … that loads up everything
<!DOCTYPE html>
<html>
<head>
<title>Page Title 2</title>
</head>
<body>
<h1>A new page </h1>
<p>New Content</p>
<a href=“/anotherpage/”> another page
</a>
</body>
</html>
@dergal
20. So why do so many SEO folks get a
cold sweat when someone says
“Single Page App”
21. So why do so many SEO folks get a
cold sweat when someone says
“Single Page App”
Especially if they say its in
React, Vue, Angular
22. “JavaScript is
Ruining the web”
Barry Adams at Search Leeds,
mentioned why JavaScript is one
of the evils in the digital world.
He had (several) good points.
25. Just a single page!
URL doesn’t change, and it is a long single
page you scroll down.
It’s all about the Parallax
Example of a Pallax scrolling page -
https://codepen.io/StephenKoller/pen/LWBLNW
26. The URL doesn’t change
As you browse from page to page, the URL in the address bar doesn’t
update. Google needs unique URLs for landing pages.
32. Spider Traps
It is easier than you’d think to create spider
traps in JS that only search engines & SEO
tools will spot
33. Duplicate Content
If URLs are dynamic, it is often easy to re-write
the URLs in different ways, and if the contents
in JS, it can be challenging for Google not to
de-dupe
36. Fragments and Hashbangs
Google has deprecated the !# but so many developers will find
documentation on it. This is where URLs use # and !
37. No XML Sitemap
No XML sitemap, which in a JavaScript App is
more important
38. So we know the
problems …
What are the solutions
39. Just a single page!
We can use JavaScript on the links to change the URL –
& Google tells us the answer!
https://developers.google.com/search/docs/advanced/javascript/javascri
pt-seo-basics#use-history-api
40.
41.
42. Tracking
Spas
Tracking interactions on a page is ‘easy’ for a developer (assuming you are using Google
Analytics) there is just a set of decisions to be made by you and your analytics guy
- Is it a page view or an interaction
- Does the tracking need to match the display URL
(usually this is best)
GTM is slightly different – for GTM we recommend pushing events into the datalayer, it is
complicated the first time, but after this, far easier.
48. SPA URLs • Parameters in ‘indexable’ pages are
not great
49. SPA URLs
Quick Rant …..
• Consistent, human readable URLs
• Always consistent trailing slashes
• Always consistent CASE (I’d suggest
lower)
• Canonical Tags must match the URL
• Parameters in ‘indexable’ pages are
not great
50. Soft 404s
Soft 404s are one of the biggest
challenges of JavaScript apps – if the
processing is largely handled at a client
side level, but a 404 is a serverside
response.
51. Soft 404s
• Does it fall outside of a page pattern
• Does it fail to load any content in
53. Soft 404s
“…. In client-side rendered single-page apps, routing is
often implemented as client-side routing. In this case,
using meaningful HTTP status codes can be impossible or
impractical. To avoid soft 404 errors when using client-
side rendering and routing, use one of the following
strategies”
developers.google.com/search/docs/advanced/javascript/javascript-seo-basics#avoid-soft-404s
54. JavaScript Links
Google can only read one type of link, there is a near infinite way of
writing them in JavaScript
55. JavaScript Links
Google can only read one type of link, there is a near infinite way of
writing them in JavaScript
58. Heavy code on 1st load
That first load, takes ………… a while
59. No Opengraph
Facebook and Twitter can’t read JS rendered metadata
This isn’t a quick win – you need to make sure that this metadata is pre-rendered.
When Facebook, Twitter, Slack and other tools fetch the page, it needs plain, HTML
metadata
<meta property="og:title" content="This needs to be in the HTML" >
60. Spider Traps
It is easier than you’d think to create spider traps in
JS that only search engines & SEO tools will spot.
TESTING is the only solution, faceted navigation and
inconsistent links is the curse here.
Test with and without JS in ScreamingFrog
61. Testing ongoing
I’d also recommend ContentKing, Oncrawl or
another tool that can render the page to regularly
check for issues! A number of cloud based crawlers do not
do JavaScript
62. Duplicate Content
If URLs are dynamic, it is often easy to re-
write the URLs in different ways, and if the
contents in JS, it can be challenging for
Google not to de-dupe incorrectly. We’ve
seen Google often get this wrong in
JavaScript rendered content
64. Internal links should always link to canonical versions and either to
absolute (starting with https) or relative to the root of the website so
starting with a / (like “/thisurl)
Just because utm_medium is on one page, it doesn’t need to be on the
next
65. Fragments and Hashbangs
Google has deprecated the #! in 2015! but so many developers will find
documentation on it…. Incredibly it still seems to work, today, but might
not tomorrow, so is it worth it!
66. Fragments and Hashbangs
IT MIGHT STILL WORK,
but then might fail tomorrow, so why not make it work correctly right now!!
This should be one of the things you don’t compromise on –
67. Fragments and SEO
Fragments do have a use in SEO – and that is for in page sections, not new /
different pages.
68. No XML Sitemap
No XML sitemap, which in a JavaScript App is more
important
78. JS Frameworks
React, Angular, Vue,
it hardly matters what you use, All are largely
equal in terms of SEO.
Personally I am team React
79. Should I pre-render
It Depends – it is easier on
smaller sites, but more
necessary on larger sites, so
normally yes.
80. Should I pre-render
“Dynamic rendering is not cloaking”
https://developers.google.com/search/docs/advanced/javascript/dynamic-
rendering
81. Should I pre-render
“Dynamic rendering is not cloaking”
https://developers.google.com/search/docs/advanced/javascript/dynamic-
rendering
82. A PWA
SEO and digital dev’s love a sexy TLA and when you’ve got
a SPA you can turn it into a PWA – a progressive web app.
A bit of extra JavaScript and a manifest file means you can
install your SPA, make it work offline and feel like a native
app. Want to see one ?
83. Service Workers
A service worker is a script that your browser runs in the
background, separate from a web page, opening the door
to features that don't need a web page or user interaction.
Being able to be installed on your phone (or computer) and
used offline means it is more reliable and quicker to find.
84. The Manifest
tells the browser about your
Progressive Web App and how it
should behave when installed on the
user's desktop or mobile device
web.dev/add-manifest/
86. Some additional thoughts
Single Page Apps, Progressive Web Apps are the future,
they are often done badly because the SEO Strategy is
missing. What happens when a page is removed? how
does google find all the pages? What are the key landing
pages?
Want to know more – ping me @dergal