SEO Strategy for Single Page Applications (SPA & CSR)

Overcoming technical challenges and implementing robust SEO for JavaScript-heavy SPA and CSR web apps.

Speakers: Yiğit Konur

Content author

26 Apr 2017

Video Transcript

⏱ 13 min read• 2,279 words

Read the full speech or switch languages

Hey everyone, Zeo followers. Today's topic is more for developers and project managers. We're going a bit more technical today. The terms above — "single page apps" and "client-side framework" — might sound foreign. Especially if you're not in the dev world. We'll walk you through all of it, slowly. We'll start with the basics. These two concepts you see here are pretty close to each other. New-generation developers built them for one reason. They wanted to give you a smoother web experience. Let's start at the foundation to see how this system works. Normally, you open a page on the web. You type "zeo.org" and hit enter in your browser. Your browser goes to a DNS server. It says: "Give me the IP address for zeo.org."

Basically, tell me where it lives. The DNS comes back with a four-part line. It says: "It's at this IP. Go ask over there." So my browser goes and fires off a request. It asks: "Can you give me zeo.org's data? They said it's here." And it gets an answer back. So there's a server on one side. There's a browser on the other. The two talk to each other. They finish the data transfer and build the web page you see. It's a solid setup. It's the technology that got the web this far. Over 90% of sites on the web still use it.

But these days, users want smoother page transitions. Well, developers do. So they add another layer here. They say: "There's a server here, a browser here. Let me build an app in between." But don't think of this app like a mobile app. It's more like an app living inside your browser. And whatever changes on the page, I load into that app. The user gets it from there. Basically it tells me up front: "Yiğit, I'm sending you an app. It's 550 kilobytes. Take it. Then I'll tell you every change. You apply it to the app." That's what it's saying.

So I'm not reloading every page. And I get a really smooth experience. That's why they're called "single page apps". Because there's just one page. I loaded it once. The only thing that changes is what comes back from the system. Based on what I do on the page. Based on where I click. There's an API system here too. It's a language apps use to talk to each other. Could be JSON. Could be XML. In that format, the server only sends the part of the page that changed. So what happens? Every page transition moves almost 20-25 times less data. And the experience is incredibly smooth.

If we talk about the advantages, mobile wins the most. Obviously, because the size drops. Why is that? Our phones are really just old computers. Slow computers. And they're not always somewhere with great internet speed. Because their positions keep changing. So on mobile, these "single page apps" give us a huge advantage. First and foremost. What kind of apps are these? Where can I find them? How do I test them? We sprinkled some in below for you. There's React. There's Backbone. There's Vue.js, you've probably heard of it. There's Angular.js, Ember, Meteor, Knockout. Lots of different options.

We even found a gap and wrote our own Yiğit JS. A new client-side framework enters our lives every day. And there's no standardization around it yet. That's honestly where the problem starts. On the advantages, we said mobile experience first. If you remember the setup here, I loaded the app into my browser once. It's not something you notice loading. But I loaded the core of that site. And all the changing data came to me through a system we call the API. Yes, so what does that mean? I get a faster page transition experience. Every transition between pages feels smooth. And what happens then? People stay on the site longer. Or a user browses more pages per session.

Because when they click a page, the content loads in half a second. That's incredible page speed. So it's user-friendly, very smooth, and maintenance costs are relatively cheaper. Once you've built it. Because all the data gets served through APIs. And you can manage that really easily. Now let's talk about the downsides. When we get to the drawbacks, the biggest one is initial load speed. What did we say? The server sends me an app first. It says: "Yiğit, talk to this app. I'll send it data through the API."

Okay, but how big is this app? These apps are genuinely huge in size. So the initial load times get really slow. That's not what we want at all. Unfortunately, that's a drawback. Then there's SEO implementation. We said Google Bot lands on a page during the SEO process. It clicks around the pages. Then it saves that info to its own database. And here's where SEO takes a hit. Because the standard take is: "Google Bot can't run pages with JavaScript." So it's a web technology. And on pages using that web technology, it says it can't run it.

So what happens then? It basically can't run my app. Because Google Browser Server got used to the old-school setup. It couldn't index this back in the day. Because JavaScript is required. That's another drawback. The two are related, after all. Now Google has solved this. How did it solve it? What action should I take? We'll cover that more comfortably in the next steps. On the other hand, these systems are usually single page. So hitting the back button can step you back out of the whole app.

We have different solutions for this, like push state. But in simple implementations, this is still a negative. On the other hand, there's development cost. The amazing developers who write all the technologies listed below are expensive. And they're a dying breed. Because there are so few of them. We're working hard to grow that pool. But their scarcity drives development costs up. Now, with all these great advantages on the table. I don't think we as SEO consultants have the freedom to say. "Don't use single page apps. Don't use a client-side framework."

Because at its core, SEO is about improving the user experience. We want to move people to a better place, a better experience. There are great advantages here. Yes, there can be downsides too. So how do I eliminate those downsides? I want using these advantages to stay profitable and sensible for me. This is exactly where we come in with different solution proposals. The first one is a system called Ajax Scrolling. Google basically says: "Okay, the web is changing. I know that. And in response to that change, I need to index this JavaScript."

But we can't claim Google lacks the capability to run JavaScript. We're talking about the biggest technology company in the world. Our basic cell phones can interpret JavaScript. So how could Google not run it? The core problem here actually starts with crawling itself. Google crawls the web broadly. If it ran all that JavaScript, crawling would slow down like crazy. It's incredibly resource-hungry. It takes serious processor power. Google doesn't want to go there. I'm talking about 2014, 2015 here. So Google says: "Okay, maybe I can't crawl JavaScript. So give me HTML output instead. Remember that two-way system, server to browser? Serve me the JavaScript-built page that way."

Think of them like screenshots, basically. Snapshots of the page. In HTML form, of course. Serve it from there. And Google says: "Push it to me with a parameter called escape fragment." Google pushed this solution hard. People used it for years. That way Google never had to index JavaScript. Users rendered pages with their own JavaScript. Then they handed those pages to Google. But it has plenty of downsides too. It's a technical topic. I won't go too deep. But every time the page changes, I have to update the cache I keep here. Otherwise Google can't see it. Tons of problems like that. It's not a system Google would pick long term. So Ajax Scrolling still gets recommended a lot by SEO folks. But honestly, it's not a great system.

Why? Because it leaves everything up to the user. You have to do a ton of implementation work. There's a technical side to it too. Not everyone can pull that off. So Google needed an alternative. At the end of 2015, they said: "No, I'm deprecating this. I'm shutting it down." "I'll pull it completely soon." But if you're still using it. You don't need to change anything. If you have to do it, go ahead. But I can already index your JavaScript, they said. So client-side frameworks and everything ending in JS down there. If Google can index them, there's no problem.

So Google should have solved the whole thing, right? That's what we'd expect. But no. That's not the reality. Google still can't always index these JavaScript frameworks well. Because it does this at world scale. It does it at massive volume. Certain errors can happen. As SEOs, our job is to eliminate those errors. So we need to find different solutions. One suggested change: "Let's make this system responsive." Let's go from a three-part setup to a two-part one. Honestly, that's a noob suggestion. Too simple. It shouldn't even be on the table. We use this system for the advantages you see here. On a standard responsive site, there's no app share in between. So I lose that performance benefit.

So switching to responsive here? I don't think that's a solution. On the other hand, there's stuff Google just rolled out, like progressive web apps. Technically they still count as a client-side framework. But they're backed by Google. That could work in our favor. It's actually a nice system. There are plenty of upsides to using it. But the development cost is really high. And right now we don't want to rip out a system to solve this. We want to make the current system SEO-friendly.

Okay. So now we focus on the third option. This is the one I really want to cover today. It's isomorphic apps. Instead of users pulling data from the app every single time. On their own machines, in their own browsers, we use a small trick. That trick shifts the whole picture a bit. I'll get into the details. This is also known as server-side rendering. You can search for it that way. Now, every framework you see down there. React, Backbone, Angular, Ember. They all basically work this way. That's the logic behind them. And they hand me the data through this app.

But what was the core downside? Initial load speed. Loading the app you see here can seriously take 2-3 seconds. And that's on a good, fast connection. For a lot of users, that's way too long. I might not want to wait that long. And that slow first load might really bug me. This is where the approach called progressive enhancement comes in. It tells us this. It says: "Yiğit, your app is huge. So load what the user sees on the main screen first." That could be my phone screen. Or on desktop, whatever shows up when the page first opens.

It says: "Send that to the user first. Once you've sent it, the user starts taking it in. Meanwhile you can load the rest of the app. That's a win for you. Don't make the guy wait for the whole app to load. Show the data they need to see first, on the initial load." "Then as they scroll down. You load the rest of the app." This is what we call isomorphic apps. You know Airbnb, the world leader in home rentals. They've put serious work into this. They also have a great write-up on it. You'll definitely run into it if you look around.

Their approach says this: "Google either indexes JavaScript or it doesn't. With this isomorphic apps system, let's hand the user the first thing they see. Just like the standard two-part setup, server to browser. While the user browses the page, we load the app in the background. And once the app is ready, it gives me every advantage on the right." So what happened here? Did this system speed up my initial load? It did. I'm serving a page like the standard two-part setup. So is there still a problem for Google? Not anymore. No, my SEO implementation is in good shape too. Yes, JavaScript is still required. But almost every browser except crawlers supports JavaScript now.

Yes, do I still need an API? I do. It's one of the modern requirements. Am I solving the back button problem? A developer building this probably implements push state too. So it's solved. My only downside is development cost. Once I integrate this isomorphic apps structure, I get all the advantages. I avoid the disadvantages. And I get great SEO performance. We SEO folks have avoided JavaScript systems until now. But look at the future of the web. Look at user needs. Look at responding fast to them. We have to pivot. We need to learn a little JavaScript. Then we can sit down with front-end developers. And actually explain what we need.

That's what I wanted to cover for now. Search for isomorphic apps on this topic. There are great articles on Medium. Airbnb has excellent ones too. Read through them all. You'll bring much smarter approaches to your project or your client. That's all for now. See you in the next video. Take care.

This transcript was generated using AI speech recognition and verified against subtitle style rules.

Yiğit Konur

Content author

Yiğit Konur

both

Contact us

How we handle your data

Open as a full page