Latest / Talk Python To Me / #263: SEO for developers
Transcript
- 0:00As developers and technologists, it's easy to think that powerful and unique ideas will percolate to the top.
- 0:06If we build something amazing, enthusiastic users will find and share our creations.
- 0:11Sometimes this happens, but more often, success is an iceberg on so many levels.
- 0:16We're going to look at one of those icebergs on this episode.
- 0:20Join me and Christian Medina as we discuss SEO, search engine optimization, for developers.
- 0:26Some of your search rankings are out of your control.
- 0:30But as you'll see, there are many tools in the developer's toolbox that directly affect your search rank.
- 0:35Let's dive in.
- 0:36This is Talk Python To Me, episode 263, recorded April 23rd, 2020.
- 0:41Welcome to Talk Python To Me, a weekly podcast on Python.
- 0:58The language, the libraries, the ecosystem, and the personalities.
- 1:01This is your host, Michael Kennedy.
- 1:03Follow me on Twitter, where I'm @mkennedy.
- 1:05Keep up with the show and listen to past episodes at talkpython.fm.
- 1:09And follow the show on Twitter via at Talk Python.
- 1:11This episode is sponsored by Kite and Linode.
- 1:15Please check out what they're offering during their segments.
- 1:17It really helps support the show.
- 1:18Chris, welcome back to Talk Python To Me.
- 1:20Hi, Mike.
- 1:21How's it going?
- 1:22Glad to be here.
- 1:23Yeah, it's going really well.
- 1:24You and I, we were supposed to be catching up at PyCon, and we're not, actually.
- 1:29That's right.
- 1:30That's right.
- 1:30We had some interesting plans for PyCon this year, and we were unable to do that.
- 1:34But oh well.
- 1:35We roll with the punches and move on, I guess, right?
- 1:38Yeah, what a bummer.
- 1:40I'm a little bit bummed that PyCon's not happening this year, but at the same time, you know,
- 1:44it's first world problems, right?
- 1:46Like, everything could be way worse than we don't get to go to our geek hall here.
- 1:49But at the same time, I really was looking forward to it, and yeah, we had some cool stuff
- 1:53for the expo floor we were going to do together, but not to be.
- 1:56Maybe 2021.
- 1:58That's right.
- 1:58I tweeted a little picture of all the badges and stuff.
- 2:01I know.
- 2:01I was going to bring online, but okay.
- 2:04Yeah, I have a big box of stickers that we'll now have to wait until the next event.
- 2:09So welcome back.
- 2:10Welcome back.
- 2:11You've been on the show a couple of times.
- 2:13You first came on the show with episode 166 for continuous delivery with Python.
- 2:18And that was really interesting to talk about continuous delivery, but it was also one of
- 2:22the shows that just had so many little tips and tools and techniques that was like, so many
- 2:29people wrote in and talked about it.
- 2:30It was like, it was awesome.
- 2:31And it was like, it was awesome, even if you don't care about CI/CD.
- 2:34So that was, that was fun.
- 2:35And then you came back and we talked about Python packaging and the options that you
- 2:39explored there.
- 2:40Yep.
- 2:40Well, what I'm wondering though, is if somebody went to the internet and they did a search
- 2:45for those things, would my site come up?
- 2:47I could tell you mine won't.
- 2:49Yeah.
- 2:51I've been reading a lot about what makes all of that work.
- 2:54So in running the stuff I do at TriExitPass, it's been interesting trying to understand how the
- 3:03internet actually works.
- 3:04You think you know how it works, but you don't.
- 3:05You think you actually have control over what you see and how you get to it, but you also
- 3:11don't.
- 3:11So it turns out that a lot of that is filtered through a bunch of companies and those tend
- 3:18to be mostly Google, but Bing plays a little role in it as well.
- 3:22So that's why, you know, if you've ever had the situation where like you're talking to a
- 3:27buddy and you Googled something and you're like, why didn't you find it?
- 3:30I Googled it and it's right here.
- 3:31Yeah.
- 3:32Then your buddy Googles it and the search results are completely different.
- 3:34There's a lot of stuff that happens in that algorithm that really has an effect on how
- 3:41well your pages show up on search results.
- 3:43Well, I think that that's a good indicator or data point for just how much the algorithms
- 3:51are playing a role here, right?
- 3:54Like if I go and search for something when I'm logged in, I get different results than if
- 3:58I search when I'm not logged in.
- 3:59And anytime I want to try to assess how is this thing actually ranking for the world?
- 4:05Like how is it really being relevant to others?
- 4:07I go and open an incognito or private window and do my search there because there's a lot
- 4:14of different things at play, right?
- 4:16There are a lot.
- 4:17And so for example, like I have, like I don't log in, like in my work account isn't tied at
- 4:23all to my home stuff.
- 4:25The results are completely different when I'm at work and do Google searches.
- 4:29And so it's interesting because, you know, one of the main reasons the internet is what
- 4:35it is, is like this freedom where everybody can post information and make it available
- 4:38to the whole world.
- 4:39But actually it turns out there's all these gatekeepers that have come up in recent years
- 4:44and it's all based on all the search algorithm and all the search engine rankings.
- 4:48Yeah.
- 4:48Everything is free and there's like this abundance of information.
- 4:51But when there's too much of an abundance, then it's not providing the information or
- 4:56the actual information itself that's valuable.
- 4:58It's the filtering and the grouping and the directing you through and just mostly get rid
- 5:05of all the stuff that's not there, right?
- 5:07Like, what do I actually care about when I'm saying like, I need to learn this thing in Python
- 5:11or I want to read something about this news event, right?
- 5:14It's not that it's trying to show it all to me.
- 5:16The actual role is to like, not show me the stuff.
- 5:19Like, show me only what matters.
- 5:20Which I think is a, it's a little bit contradictory to the way the internet started, right?
- 5:25Like it started out with like, I don't know.
- 5:28I think of Yahoo as like the most prototypical early, early, early days where it was literally
- 5:34a directory.
- 5:35A directory, yeah.
- 5:36Like the yellow pages of the internet, right?
- 5:38Yeah.
- 5:38That's right.
- 5:39So crazy.
- 5:40It's all been kind of like incremental steps on how to make it easier for you to find stuff,
- 5:44but also how does the search engine determine what is a valid result for you?
- 5:49But you know, by them doing that, that means they have applied a filter on all of the websites
- 5:54in the world, right?
- 5:55In order to do this.
- 5:56And if you're just a lonely old guy that wrote something that you just want to make it out,
- 6:01polish it out there, people finding it is not as easy as it sounds.
- 6:05Just publishing something on the internet these days is not enough.
- 6:09Yeah.
- 6:09It's not a field of dreams.
- 6:10That's right.
- 6:10Build it and they will come sort of thing, right?
- 6:12So maybe let's take a real short step backwards and talk a little bit about TriExceptPass,
- 6:18what you're doing there, what you're trying to grow there and whatnot, just to give people
- 6:23a sense of like, why are you studying these things?
- 6:25What are you trying to do?
- 6:25Sure, sure.
- 6:26So I started TriExceptPass almost five years ago now, which is kind of crazy.
- 6:31That's insane, right?
- 6:32As a medium blog, right?
- 6:34And so then I had the domain name, the TriExceptPass.org.
- 6:37And then I wanted to get off the platform and start building my own thing.
- 6:41So I have a website.
- 6:42There's a collection of articles about how to build real world software, problems you run
- 6:47into with engineering and stuff like that.
- 6:50And now we have a podcast on top of it, right?
- 6:52Yeah.
- 6:52Your podcast is pretty new, right?
- 6:53You've got like six, seven episodes.
- 6:55We're up to episode eight this week.
- 6:57Yeah.
- 6:57Yeah.
- 6:57I'm going to be putting them out more regularly now.
- 7:00But yeah.
- 7:00So based on that, I really wanted to go hard on trying to get more visitors last year.
- 7:08And I started to read about what I needed to do in order to make that happen.
- 7:11And I have discovered all this stuff that I thought about SEO as SEO, meaning search engine
- 7:19optimization, right?
- 7:20Because we technically haven't defined the term.
- 7:22So when people talk about how to make your website visible in a search engine, they're
- 7:26talking about optimizing it so that it shows up appropriately, right?
- 7:29So I had traditionally thought about this being more kind of like a keyword thing that maybe
- 7:34marketing does or sales or somebody else does for a large company website.
- 7:38But I hadn't realized-
- 7:40Yeah.
- 7:40The site works.
- 7:40I wrote it for you.
- 7:41Now it's up to you.
- 7:42That's right.
- 7:42Your turn.
- 7:43Here you go.
- 7:43You get it to rank, baby.
- 7:45Yeah.
- 7:45Fill in the fields and you're done, right?
- 7:47But it doesn't work that way.
- 7:48It turns out you need a bunch of hooks in there in order for it to actually be
- 7:52picked up appropriately by the search engine algorithms.
- 7:57And I'm not just talking about the traditional, like there's always been these like robots.txt
- 8:02files or sitemaps, XMLs that help search engines a little bit.
- 8:05But it's way, way deeper than that with a bunch of meta tags and formatting and a bunch
- 8:12of stuff that we'll get into in a minute.
- 8:14Right.
- 8:14And performance is playing a much more significant role in SEO than it has traditionally.
- 8:20That's right.
- 8:21And one of the main things is that because mobile is such a big thing, then performance has become
- 8:26a lot more important.
- 8:28It's always been important because the better performance you have, the more global access
- 8:34your website gets because internet is not the best everywhere in the world.
- 8:38But with mobile, that has become more of an issue because not everybody has like the fancy
- 8:44high speed phones, right?
- 8:46Right.
- 8:47So it turns out that a lot of how your website is ranked is tied to that.
- 8:53Yeah.
- 8:53So I'm looking forward to talking about all of these things.
- 8:56I just kind of want to put it out there at the beginning though.
- 8:58I feel like that it's so easy to fall into the trap of, well, a little bit of like, if you
- 9:04build it, they will come.
- 9:05Right.
- 9:06Like if I build something cool, people will eventually find it and it will rise to the
- 9:11top.
- 9:11If I build some amazing site, some service, some product, whatever, I want people to come
- 9:15check it out.
- 9:16If it has merit, people will come and love it.
- 9:20And you know, stuff like this, as you know, the SEO, as well as like the other sides of marketing
- 9:26and just getting the word out, right?
- 9:28It's so tricky and vague, but it is actually what you have to do to make that succeed, especially
- 9:35in a world of abundance like we are now.
- 9:37Yeah.
- 9:37So building great content is just like step one.
- 9:40However, there is still an aspect of if you build it, they will come because if you built
- 9:46something that's fantastic that everybody wants to read, then more web pages will link to it.
- 9:51And that also has an implication in your rankings as well.
- 9:54Yeah.
- 9:54But yeah.
- 9:55I'm sure you probably don't have any insight to this answer and I'm just speculating, but
- 9:58you know, Google is built on page rank, which is sort of how many pages refer back to
- 10:04a given page in super early days.
- 10:06That was like the primary link.
- 10:08And then people would go do stupid stuff.
- 10:09Like they would buy links on other domains, like just pages of links or other really shady,
- 10:14stupid stuff.
- 10:15I wonder at some point though, when is like machine learning going to be the thing that
- 10:21decides, right?
- 10:22When is it going to be just like, well, there's a deep neural net.
- 10:25It already is.
- 10:25Yeah.
- 10:25You think so?
- 10:26Oh, it's big time.
- 10:28So that's why Google is pretty much an AI company.
- 10:31That's what they have, right?
- 10:33Yeah.
- 10:33Vast amounts of machine learning to try to parse.
- 10:36I mean, these things are reading the content of your web pages to decide how to rank it.
- 10:42It's not just about links.
- 10:43It's about the structure, the grammar, how many images you have, how well the images are
- 10:49formatted, how it flows, all that.
- 10:51All that's all machine learning.
- 10:52Wow.
- 10:53Okay.
- 10:53It's crazy.
- 10:53That's pretty awesome.
- 10:54Yeah.
- 10:55I didn't realize this was so advanced.
- 10:56I mean, I always kind of knew, but I didn't expect it to be this advanced.
- 11:01Yeah.
- 11:02Well, there's so much money behind it, right?
- 11:03Yeah.
- 11:04Yeah.
- 11:04That's right.
- 11:04In terms of advertising, right?
- 11:06It's one of the most valuable companies in the world.
- 11:08And that's basically makes them an advertising company.
- 11:11But the ads are around like this kind of stuff.
- 11:14So I can see, I guess so, why there's so much effort.
- 11:17And the other interesting part is, right, that ranking algorithm, the SEO algorithm that Google
- 11:22uses generates entire industry.
- 11:25There's people that exist around how that algorithm works.
- 11:29And Google doesn't tell you how it works.
- 11:31It kind of gives you clues here and there.
- 11:33But what happens sometimes is they update it.
- 11:36And so then there's people that have been sitting at the top of the first page of your 10 results
- 11:41off of Google and all of a sudden become number 100.
- 11:43And there's like real economic consequences out of that.
- 11:48Especially for like blogging community, people that live off of content that they produce
- 11:53in smaller websites kind of thing.
- 11:55They're always on top of that.
- 11:57Right.
- 11:57So let's start with defining a couple of terms that you have here.
- 12:00One is domain rank and one is page rank.
- 12:03Yeah.
- 12:03So we've been talking about ranking a little bit.
- 12:05So what happens is each page in your website gets ranked.
- 12:10And there's a lot of things that come into that.
- 12:13And it's like you get a grade, right?
- 12:15And the higher the grade, the better.
- 12:17From the tidbits of information I've been able to gather here and there, we just kind of talked
- 12:22a little bit about it.
- 12:22It's the content matters.
- 12:24How many words in the page matter?
- 12:27Grammar.
- 12:28How performance.
- 12:29We'll get into that later.
- 12:31The links from external websites that are linking to your page and the links from your
- 12:36page that are going to external websites.
- 12:38Not just how many, but like what specifically, how that hierarchy is set up matters, right?
- 12:46And so that gives you a grade, right?
- 12:48And so then to your page.
- 12:50But there's also a grade to your domain.
- 12:52So like I have track set pass ORG and that has a rank and that rank might, I just checked
- 12:58just a little bit ago that rank was in the 30s, 33 or something like that, which is, I'm
- 13:02actually happy about that, which is not a great rank, but it's good because I started in the
- 13:0720s, but it took me a year to get to 33, right?
- 13:10Yeah.
- 13:10Where do you check this rank?
- 13:12Yeah.
- 13:12So there's a bunch of tools that do this.
- 13:14So aside from Google having their own little internal search engine ranking stuff, there's
- 13:20entire companies that do this.
- 13:22And so I use Moz.com, but there's also Alexa.
- 13:25I've seen some of those.
- 13:26They have some free accounts you can get with them that gives you some extra information and
- 13:31allows you to do some searching and limits how many searches you can do.
- 13:34But you can also, you know, if you get like a full blown account, you can like get into
- 13:39like many great details.
- 13:40But those guys keep their own thing too, right?
- 13:44They give you a ranking, but it's not the ranking that Google's giving.
- 13:47It's just an approximation of what we think Google will be giving.
- 13:52And really, really the key player is Google.
- 13:55It's crazy.
- 13:56Yeah.
- 13:57I mean, there are other search engines, but they're pretty safe to just ignore them.
- 14:00Right.
- 14:00I mean, there's Bing.
- 14:01Yeah.
- 14:02Bing still gets a little bit.
- 14:03Yeah.
- 14:04And there's DuckDuckGo.
- 14:05Right.
- 14:06Yeah.
- 14:06Actually, I've been using DuckDuckGo for six plus months now as my primary search engine.
- 14:12Yeah.
- 14:12Okay.
- 14:13How's that experience been?
- 14:14Yeah.
- 14:14It's been working nicely.
- 14:15I like it.
- 14:16And they got very similar tools to what you get out of Google search.
- 14:19But, you know, they're still building up their stuff.
- 14:22So every once in a while, you still got to do the Google search.
- 14:25I don't know.
- 14:26I've wanted to use DuckDuckGo.
- 14:27And I very much support the privacy side of things.
- 14:29Like, I would prefer to give less to Google.
- 14:33Although, I don't hate them.
- 14:34I think they offer a lot of great services.
- 14:35But I'm a big fan of using Firefox over Chrome, for example.
- 14:38And DuckDuckGo seems like a really easy choice.
- 14:40Like, searching for stuff is so essential that, like, even if it was down 5%, I feel like I really want to do that to myself.
- 14:49You know?
- 14:49Yeah, yeah, yeah.
- 14:50I get it.
- 14:51I'm trying to find that one, like, thread race condition for SQLAlchemy.
- 14:56Uh-huh.
- 14:57Like, I just don't want to, like, it's already, I'm already frustrated a lot of times if I'm in that kind of scenario.
- 15:01And I'm like, I really need the best answer.
- 15:03Like, the best answer.
- 15:04Yeah, yeah.
- 15:05And so I've had a few of those lately.
- 15:08And, yeah, it helps, you know, the Google algorithm is better for some of that stuff.
- 15:11This portion of Talk Python To Me is brought to you by Kite, the smart AI-powered autocomplete for your editor.
- 15:19As developers, our choice of editor is central to our work.
- 15:23The more powerful and effective that that editor is, the more effective that you are.
- 15:28That's why I'm excited about Kite.
- 15:30Kite is a free plug-in for your code editor that gives you ML-powered autocompletions and documentation.
- 15:36Chances are, it works with your editor of choice, even if that editor has existing autocomplete features.
- 15:42The list includes PyCharm, VS Code, Atom, Sublime, Vim, and more.
- 15:46And Kite runs locally.
- 15:48So your code is private with no cloud or internet connection necessary.
- 15:52And the Kite is 100% free.
- 15:54So try it today at talkpython.fm/kite, K-I-T-E.
- 15:58And see how Kite can help you be more effective with your Python code.
- 16:05We talked about domain rank and those kinds of things.
- 16:08So I went to Moz.com and I clicked on free SEO tools.
- 16:12And that comes up and says, enter your domain and we'll tell you a couple of things.
- 16:15And then I also went to a private incognito window and did a search.
- 16:20So one of the things that I am a little bit proud of, impressed with myself that I was able to do,
- 16:25is that if you do a, it's super important that you're not logged in, right?
- 16:29Because it totally could vary on your history.
- 16:31That's right.
- 16:32At least where I am now, at the time it is now, it's been here for a while.
- 16:37If I go to Google and I search for free MongoDB Python course,
- 16:42the number one result is freemongodbcourse.com, which is my course for my,
- 16:48like it's a landing domain.
- 16:51Good job.
- 16:51That's not easy.
- 16:52And like number three is MongoDB's actual free courses, right?
- 16:59Nice.
- 16:59Which are taught in Python.
- 17:00Nice.
- 17:01So I'm feeling really good about that.
- 17:03I put that into that domain.
- 17:05There's only one page there, right?
- 17:06So I think that hurts it a little bit, but if the search lines up just right, it's okay.
- 17:11So because it only has one page, it is like a page, basically the domain authorities, 22.
- 17:18Yeah.
- 17:19So that's kind of okay.
- 17:20I'm not sure what to think about that, but it's low, but it's okay.
- 17:24It's low, but it's like one niche thing, right?
- 17:26Yeah.
- 17:27It's ranking keywords are 36.
- 17:29I don't know what that is,
- 17:30but the spam score is only 2%.
- 17:31So that's pretty good.
- 17:32And then I threw a talkpython.fm in there and that's domain ranking of 49.
- 17:37Yes.
- 17:38That's very good.
- 17:38Yeah.
- 17:39That's awesome.
- 17:39And it's spam score is 1% and it has 1.6 thousand ranking keywords.
- 17:44Sure.
- 17:45Okay.
- 17:45Yeah.
- 17:45So the ranking keywords is the stuff that search engines would use to figure out whether to list your website as a result or not.
- 17:55Theoretically, the more you have, the more you have, the better.
- 17:57I see.
- 17:57It also shows you cool things like here are the top ranking keywords.
- 18:01Uh-huh.
- 18:02And it's right.
- 18:03I guess this is where it ranks.
- 18:04If you were to search for this, like Python podcast, it's number one.
- 18:09Async techniques and examples in Python, it's number one.
- 18:12That's kind of cool.
- 18:13And then it has like more by number of clicks.
- 18:16So it has like 100 days of code where we're not that high, but it's like there's a ton of search clicks for it.
- 18:23I feel like this actually gives me a lot of pretty interesting information.
- 18:28If there's another tool in there about link research and you can pop your website in there and it tells you the things that link to you.
- 18:35That's also important.
- 18:36Yeah, absolutely.
- 18:38So we were talking about your rank, what links to you matters because it helps your rank.
- 18:44But the quality, like the domain authority of the sites that are linking to you is a modifier on how much that link matters to your website.
- 18:53Right.
- 18:53Because there are aggregators.
- 18:54So like I found that like I have a bunch of aggregators that link to me, but their domain authority is so low that they don't really affect.
- 19:03Those links don't really affect my stuff.
- 19:05Yeah.
- 19:05So it's like multiplying by zero, right?
- 19:06These links are coming in, but they mean nothing because they're like so badly ranked.
- 19:10That's right.
- 19:11And interesting, we talked about like my domain rank for tracks that passes 33, but some of the pages in there have a different page authority.
- 19:19Like the microservices article of mine has the highest page rank of page authority of 52.
- 19:26Oh, that's pretty good.
- 19:27Yeah.
- 19:27It's interesting how all that plays a little bit.
- 19:30And so if you go to that tool that does some link research for you, it'll show you the number of links you have as well based by the domain authority of the linkers.
- 19:40And that brings me to something else we'll talk about later about how you do your A tags, your href tags in HTML and why that matters.
- 19:49We'll talk about that later.
- 19:50Yeah.
- 19:51I think there's some really some of these great tools out there that I think people just don't think to use.
- 19:57Like I used Moz a long time ago when I was setting up my training sites to try to understand how I might make it rank better.
- 20:05But then I actually forgot about, I didn't forget about Moz, but I like it went off my radar and I stopped using it.
- 20:12Like I literally haven't been to Moz.com or whatever the URL is for like a year.
- 20:16Right.
- 20:16But I should be going there frequently and like looking at how things are evolving.
- 20:20What are new trends and how can I get involved with that?
- 20:22Like what has some traction and what can I make it grow?
- 20:25Right.
- 20:26You got to be careful not to do it too often because all this stuff takes like weeks to propagate.
- 20:31It's like changing DNS servers or something.
- 20:34You know, it takes days.
- 20:35Well, this takes weeks.
- 20:36Does it work now?
- 20:37Like, no, you need to stop asking.
- 20:39It's just wait a while.
- 20:39Yeah.
- 20:40Right.
- 20:40Yeah.
- 20:40So in terms of tools while we're on it, like the Moz one is great for getting domain ranks and links and stuff like that.
- 20:46But there is a Google search console as well.
- 20:49Have you used that one?
- 20:50I have used that one.
- 20:51And that is pretty good.
- 20:52You can say, show me some of the keywords.
- 20:54How do I rank against them?
- 20:56What are my popular keywords?
- 20:57And you can trust that even a little bit better because it literally is from Google, right?
- 21:02Google says here's how we would rank you for this thing.
- 21:04Yeah.
- 21:04And the interesting part is you get like how often people have been clicking in search results to your domain.
- 21:10You get total number of times you've shown people your domain.
- 21:13Like I was looking at my stuff.
- 21:15I have like 2% average click-through ratio is what they call it.
- 21:19So my domain's been shown 240,000 times in the last three months, I guess.
- 21:25And out of that, it's been clicked 4,800 times.
- 21:29And it gives me the average position that shows up on the Google search results.
- 21:33And the goal is, like you said earlier, to bump that into at least the top 10, right?
- 21:39And depending on what...
- 21:40And you can play with that to find which search keywords give the highest position.
- 21:46Like I have...
- 21:47If you look for distributing Python applications, I'm number 4, according to the search console, right?
- 21:52But the domain just in general is on average of 20.
- 21:56Okay.
- 21:56It's a lot of little things.
- 21:57Yeah, there are.
- 21:59So let's see.
- 22:01If I go here, yeah, 4.
- 22:04I got to have a range, I guess.
- 22:06This is over the last couple months.
- 22:10Search results, 18,688 total clicks.
- 22:13That's pretty cool.
- 22:14Yeah.
- 22:15The other one that's really interesting that I guess we should maybe talk about, this is like definitely on the developer side, is error pages, sitemats.
- 22:24Yes.
- 22:24That kind of stuff.
- 22:25Because the next graph that I see here is a graph that says, here's the coverage of our searching of your site.
- 22:31You have 3,573 valid pages, which might blow people's minds, but there's like all the courses and every lecture of the course has its own transcript landing page for SEO somewhat and for usability.
- 22:43Like there's a ton of pages.
- 22:45And it has the number of errors.
- 22:47Right now I have zero errors and 3,573 valid pages.
- 22:50And it shows the growth of errors over time and pages over time.
- 22:53And I put a lot of work into making sure that my sitemap is like complete.
- 22:57How much do you think that matters?
- 22:59It's important.
- 23:00And they use the sitemap to figure out how to crawl.
- 23:03So not only is that important for your main page.
- 23:08So you have a staging page.
- 23:09I don't know how you do your stuff, but like I have like a staging version of Trax Set Pass where I try stuff out.
- 23:14You can configure stuff, not just with the sitemap, but with like robots.txt so they don't crawl those pages because you don't want those to show up
- 23:22and affect your search results, especially because they're going to have errors and stuff like that.
- 23:26So as a developer, that's one of the things you got to worry about.
- 23:29I was working on a website for my company and application service a while back.
- 23:35And that's like we had a staging version.
- 23:38I didn't know about any of this.
- 23:39And I'm like, oh, man.
- 23:39So our domain, we had like staging.r stuff and just the regular production version.
- 23:44I'm like, oh, maybe all this affected our page rank out on the real internet.
- 23:47Right.
- 23:48Yeah.
- 23:49It's basically it might divide it by two, right?
- 23:51Because it's the same content.
- 23:52And so.
- 23:53That's right.
- 23:53So that brings me, might as well talk about it now.
- 23:55So we've been talking about links.
- 23:57So having copies of your content counts against your rank.
- 24:02Right.
- 24:03It basically dilutes the value and then other things are able to get above it.
- 24:07Right.
- 24:07Yeah.
- 24:07So essentially, they try to figure out whether you're plagiarizing your own content, like
- 24:12whether the domains are plagiarizing it, essentially.
- 24:14Right.
- 24:15Yeah.
- 24:15So if you have like the exact same article show up somewhere else, that becomes like that
- 24:21whole page, that whole article, both yours and the other person's will have a lower ranking
- 24:27compared to yours.
- 24:28And so that's why, like if you go to sites like dev.2 and you publish something there,
- 24:34you can link to your article, to your original source, and you add an extra piece of information
- 24:42in the tag, in the HTML tag that says this is a canonical link.
- 24:46So that means that the original source, you're pointing to the original source, and then the
- 24:52search engines won't count dev.2 against your original article.
- 24:58And they'll actually complement each other.
- 25:00Right.
- 25:00Okay.
- 25:01So I ran into something like that recently.
- 25:04I had the strangest problem, which I came up with an even stranger solution to.
- 25:10I spent days, days trying to solve this problem.
- 25:14If you went to talkpython.fm/forward slash, or training. talkpython.fm/forward
- 25:21slash, I don't remember which of those two sites it was that had the problem.
- 25:24They're both on, they're both on Ubuntu 18.
- 25:27They're both running Nginx.
- 25:29They're both running the same type of certificate.
- 25:31They're basically identical servers.
- 25:34One of them in Safari, whether it was mobile, like this is actually where it matters a lot.
- 25:39It's like all of iOS.
- 25:41You would go to one of them.
- 25:42It would say it was an error where like the site said it disconnected.
- 25:46Like the connection was reset was the error.
- 25:49You look at the logs and it was fine.
- 25:50You look at the logs and it was fine, right?
- 25:51I see.
- 25:52Yeah.
- 25:52But any other page on the site was fine.
- 25:54Like slash episodes was fine.
- 25:56Slash about was fine.
- 25:58Slash anything other than slash home was fine on one server.
- 26:03The other server was fine everywhere.
- 26:04I spent days trying to figure this out and figure out what the different, like everything I could tell with the two servers were set up the same.
- 26:11And I just finally said, you know what?
- 26:12If iOS is happy with slash anything, but the slash like by itself, I'm just going to redirect it to slash home and have slash home be like a copy of the homepage.
- 26:23That is for anytime I detect Safari.
- 26:26I'm like, dude, we're just going to redirect you to like another URL that's deeper in the site, but it shows the same content because that one renders fine and just the forward slash it over.
- 26:36Right.
- 26:37So I was like, forget this.
- 26:38But what I didn't think about was the SEO impact of that.
- 26:42Right.
- 26:43Because if Google comes as today, I want to be Safari.
- 26:46Let's see what's up.
- 26:47Like, oh, I'm over on this other page, which looks like the same content as Chrome saw yesterday on forward slash.
- 26:54One of the listeners said, you know, you have the same content.
- 26:56You really should use this rel equals canonical on there.
- 27:00And so what I did to like stop undermining myself while still making iPhones work was to just put like do a test.
- 27:08Like if it's slash home in the template, just put a meta tag that says or whatever kind of tag says rel canonical is the forward slash URL, not the forward slash home URL.
- 27:17That's right.
- 27:17But this can be used in other places.
- 27:20Like if you want to write on Medium, but also on your blog, but have your blog get the SEO juice.
- 27:26I don't know if it works on Medium.
- 27:28It works in some place like Dev2 and other places, right?
- 27:30Dev.2 has it like in there stuff to set it up.
- 27:34You have the capability of doing that.
- 27:35In Medium, I know you can add some HTML stuff in there.
- 27:39So it might.
- 27:39That's one of the reasons I got off of Medium a while back.
- 27:42Honestly, I'm not a fan of Medium.
- 27:44I think it's a beautiful site.
- 27:45It's a nice experience, but I, it just, there's just.
- 27:49The paywall killed it for me.
- 27:50Dude, there's just too many things that go against the grain.
- 27:52Like I'm not even against a paywall.
- 27:54Somebody says like, I want to do like deep writing and have people pay for that.
- 27:58That's great.
- 27:59Like that's, that's their work and their choice.
- 28:01But I feel like Medium was built up on the back of this is a free place that people can do awesome writing.
- 28:06Let's all get together and then like yank on the rug and now it's paid.
- 28:10Right.
- 28:10You know what I mean?
- 28:10It's like, I feel like they didn't build on that ethos.
- 28:13And so it's like a bait and switch.
- 28:15Yeah.
- 28:15That's what I don't like it.
- 28:16Yeah.
- 28:17Yeah.
- 28:18Yeah.
- 28:19That's what killed it for me.
- 28:19And so like for me that switched off of Medium, it was really hard.
- 28:23I mean, I used to get people following me on the Medium article.
- 28:26Right.
- 28:27And I'm like, how do I bring that traffic to my website?
- 28:30Right.
- 28:31Yeah.
- 28:31Yeah.
- 28:31For sure.
- 28:32So while we're on it, this is not exactly SEO, but it does talk about rank and keyword and relative
- 28:38stuff.
- 28:38And it's really good for exploring other sites.
- 28:43So have you played with SimilarWeb, SimilarWeb.com?
- 28:46No.
- 28:47I saw you added the link.
- 28:48I pulled it up, but just barely looked at it.
- 28:51Yeah.
- 28:51So if you go in there and you just type in any domain, like you could type in like talkpython.fm
- 28:55or you could talk real Python or try accept paths.org, whatever you want.
- 28:58It'll come up with a ranking.
- 28:59It only has like tons of information for sites that are ranked well enough, but it will show
- 29:04you like traffic over time month by month.
- 29:07Right.
- 29:08So right now it says I'm getting 56,000 unique visitors a month who spend an average of four
- 29:14minutes and visit 3.45, 3.42 pages and so on during their visits.
- 29:20And this is not because there's plugs.
- 29:22I don't even show up.
- 29:23It's not.
- 29:23Yeah.
- 29:24Well, it's got to get to like a certain level.
- 29:25Right.
- 29:26But you could take any, like if you have a competitor or something you're trying to
- 29:30like, Hey, we're building a site.
- 29:31We want it to rank.
- 29:32Here's some of our competition and they're ranking well.
- 29:35So you can put that in there and you can see like traffic by countries, traffic sources,
- 29:40the referrals, the places that are linked, like you talked to linking into it.
- 29:43So apparently GitHub, python.org, forums.fast.ai, all these are like strong linking, referring
- 29:50sites to mine.
- 29:51Not because I know that, but because this external thing is like tracked it just.
- 29:55Yeah.
- 29:55Okay.
- 29:56Whether the traffic is paid.
- 29:57So this is a good one for like how, then you could put another domain next to it and
- 30:02it'll put those charts next to each other and say, here's how you compare to that other
- 30:06place in general ranking traffic, types of traffic and whatnot.
- 30:10I could have sworn that some of this was also available in Moz.
- 30:14If I find it, I'll give you a link.
- 30:19This portion of Talk Python To Me is brought to you by Linode.
- 30:22Whether you're working on a personal project or managing your enterprise's infrastructure,
- 30:26Linode has the pricing, support, and scale that you need to take your project to the next
- 30:31level.
- 30:31With 11 data centers worldwide, including their newest data center in Sydney, Australia, enterprise
- 30:37grade hardware, S3 compatible storage, and the next generation network, Linode delivers
- 30:43the performance that you expect at a price that you don't.
- 30:46Get started on Linode today with a $20 credit and you get access to native SSD storage, a
- 30:5240 gigabit network, industry leading processors, their revamped cloud manager at cloud.linode.com,
- 30:57root access to your server, along with their newest API and a Python CLI.
- 31:02Just visit talkpython.fm/Linode when creating a new Linode account and you'll automatically
- 31:08get $20 credit for your next project.
- 31:10Oh, and one last thing.
- 31:11They're hiring.
- 31:12Go to linode.com slash careers to find out more.
- 31:15Let them know that we sent you.
- 31:16That type of analysis is really, really interesting and useful.
- 31:22Yeah.
- 31:23Because, yeah, that helps determine how well your stuff is going to show up.
- 31:27So, speaking of moths, they wrote a pretty interesting article called The Beginner's Guide to SEO,
- 31:33which you're linking to.
- 31:35We'll put it in the show notes.
- 31:35Yeah.
- 31:36And we've heard of Maslow, Maslow's hierarchy of needs, right?
- 31:40You need shelter and then you need like human contact.
- 31:43You know, then you need food or maybe you need food, then shelter, right?
- 31:46But whatever, like eventually way, way up there is like entertainment and fulfillment.
- 31:51You know what I mean, right?
- 31:52That's right.
- 31:53Yeah.
- 31:53So, there's something like they put together like this for SEO and says like, you must have
- 31:58this to be ranked.
- 31:59And then like you can be more competitive as you layer on more advanced stuff.
- 32:03Do you want to talk us through that?
- 32:04Yeah, yeah.
- 32:04So, we can go through the pyramid and some of these we'll dive into a little more detail
- 32:09in a little bit.
- 32:10So, like right at the bottom, right, is crawl accessibility.
- 32:15So, that means that your website must be the search engine crawlers, the robots that go out
- 32:21and just scrape the internet and formulate the model or whatever to find search results.
- 32:26Your website needs to be crawlable, essentially.
- 32:29And that means you have to have good HTML and good things for those robots to actually be able
- 32:34to parse the information.
- 32:35Right.
- 32:35And that's a little bit like what I was talking about with the sitemap and the number of pages
- 32:40versus the number of discovered pages.
- 32:42Right.
- 32:43But it also means like if you go to a part of your site is behind a login or a paywall or
- 32:48some other interaction, that is blind to the world.
- 32:51Right.
- 32:51That is no longer part of the search index of the world.
- 32:55And so, you just got to like, it might be fine.
- 32:57That might be your personal account info or whatever.
- 33:00You don't want it to be.
- 33:00But sometimes I see people building sites in a way that I think, oh, you don't want to do
- 33:05that because Google's not going to get there.
- 33:07And that's a problem.
- 33:10Yeah.
- 33:10So, that's why single page web apps are an interesting, have an interesting situation
- 33:16when trying to be searchable.
- 33:18So, you'll find that a lot of like say, just to pick something like say Linode or whatever.
- 33:24And I'm not saying that they are a single page web app.
- 33:26But you'll find that a lot of these companies that have consoles or something that some application
- 33:31type of thing that's available through the website, they actually have a landing page.
- 33:35And then from the landing page, you can load up the web app.
- 33:39You can't have the whole thing be the web app or the stuff just won't start, won't show
- 33:44up on the search engine.
- 33:44It's behind JavaScript.
- 33:46Exactly.
- 33:46If you look at Vue Source of like a VJS app, it's entirely underwhelming.
- 33:52And it always looks the same because the data is not loaded yet, right?
- 33:56That's right.
- 33:56And in fact, it might even count against you, which is like the next ring in the pyramid
- 34:02is having compelling content.
- 34:04The only thing that the search engine will find there is just JavaScript.
- 34:08So, it's not going to know what any of that means or what the paragraphs are, what the
- 34:14information is, nothing.
- 34:15So, that's it.
- 34:16Yeah, I'm wondering if these days, if like when Google sees that, they're like, you know
- 34:20what, we have to fire up Selenium and hit this page to like get the answer, right?
- 34:25They may look for Vue.js, Angular, the couple popular ones and say, we got to-
- 34:29Yeah, I'm sure they do.
- 34:30We got to do a little more.
- 34:30They probably do.
- 34:31But it can't be helping, right?
- 34:34Like even if eventually it does figure it out, I just feel like these spa apps cannot be helping
- 34:39their SEO case.
- 34:39No.
- 34:40There is some stuff that's been built to help all of that.
- 34:43I haven't looked too much into it, but there are things to help that side of the world.
- 34:48Yeah.
- 34:48Yeah.
- 34:48Okay.
- 34:49So, compelling content, that's important.
- 34:51It's sometimes tricky to do.
- 34:53I suspect like images.
- 34:55Like if you try to tell the story with a picture instead of with words, that might actually hurt
- 34:59you a little bit in terms of SEO.
- 35:00But when you make that image tag, you can have enough information in the image tag, which also
- 35:06helps the rankings.
- 35:07Like in the title or the alt or something like that?
- 35:09The alt, yeah.
- 35:10Okay.
- 35:11So, there's that.
- 35:12And then just like the size of the content, just general grammar stuff, how the paragraphs
- 35:17are broken up, how many.
- 35:18In fact, having content for multiple languages also counts for you.
- 35:22There's all kinds of stuff like that.
- 35:24And if you're doing like international stuff like that, where you have like multiple versions
- 35:27of your site, that's like a whole new, like I wanted to do that recently because I wanted
- 35:31to, you know, Spanish is actually my first language.
- 35:34So, I wanted to write the site in Spanish and provide a Spanish version of it.
- 35:37And I started to look into, wait, what about like the canonical stuff?
- 35:41And like, what's going to show up here?
- 35:42And it's like, there's all these rules.
- 35:43I was like, I don't have time to look at all of this.
- 35:44It was already going to be a lot of work to rewrite it in a second language.
- 35:48And now you've got to like re-SEO it.
- 35:51And like, not just redo the SEO, but you got to make sure you don't hurt yourself, right?
- 35:57Because if it shows up in two languages, it could be worse than just having one if
- 36:01it thinks that's like copied, right?
- 36:03Yeah.
- 36:03When we're talking about this, you know, we're not just talking about like, do I have the right
- 36:07keywords, which is actually the next ring in the pyramid, you know, having,
- 36:10having the words that are searchable that represent what the article is about, right?
- 36:17But we're talking about like, just like HTML formatting, right?
- 36:21If you don't have the right tags in the right places with the right properties, stuff doesn't
- 36:27get picked up correctly.
- 36:28And I mean, as a developer, I mean, it makes perfect sense.
- 36:30Somebody wrote some code to go and crawl this website, right?
- 36:34And, you know, they're at Google.
- 36:35They're like, well, I'm going to look for this.
- 36:37If you don't put that in there, oh, well, right?
- 36:39You want me to rank you?
- 36:40Well, then put that in there.
- 36:41And Google's got like, they're all documented.
- 36:44All that stuff as you search around.
- 36:46Yeah.
- 36:47Yeah.
- 36:47For sure.
- 36:48Next up, I guess, keyword optimize.
- 36:50Is that, have we talked about that yet?
- 36:52Yeah.
- 36:52That's what we were just talking about.
- 36:53Yeah.
- 36:54Okay.
- 36:54Then above that is the great user experience.
- 36:58Now we start getting a bit deeper into actual developer action.
- 37:01Yeah.
- 37:01And this is where the developer story starts to like really be your story around SEO.
- 37:08I mean, obviously you've got to have crawl accessibility, right?
- 37:11If your site crashes, if it's unreliable, if it doesn't generate the site map quickly or
- 37:16correctly, then all those things are right.
- 37:18Like you're not even like alive on the hierarchy.
- 37:21You're at the bottom and you're not there.
- 37:23But here you have things like fast load speed and ease of use.
- 37:26And the wording here is compelling UI on any device, but like the developer word is like
- 37:33a program.
- 37:34Not a program.
- 37:35Yeah.
- 37:35Like viewports and like responsive is the word I was looking for.
- 37:39Responsive UI that, that like actually will look right on the device.
- 37:44That's right.
- 37:44Now you're well into the web developer, Python developer side of the story.
- 37:48And there is so much here and we can talk, skip ahead a little bit around making your load
- 37:54times better.
- 37:55There's a bunch of tools.
- 37:56There's some, there's a website from Google called PageSpeed, which you can go and plug
- 38:01in a URL and it'll go do these rankings for you, these checks for you.
- 38:06Yeah.
- 38:06And then there's a tool called Lighthouse, which runs on Chrome.
- 38:09So if you have Chrome developer tools, you can get it to actually launch and run it locally.
- 38:13And so what it does is it analyzes a website and you can ask it to do it, do an analysis,
- 38:20assuming you're running from a desktop or assuming you're running from a mobile phone with a fast
- 38:25speed or assuming you're running from a mobile phone with a slow connection, right?
- 38:28And it'll do all this analysis and you'll get into a bunch of things like what format are
- 38:35your images?
- 38:35You know, are you PNG?
- 38:36Are you JPEG and all that, right?
- 38:38And then it turns out that do they have the right compression ratios?
- 38:41How big are they relative to the page?
- 38:44Are you loading a 2000 pixel white image on a 400 pixel white page?
- 38:48You're just wasting people's time when you do that, right?
- 38:51Right, right.
- 38:52And when I logged into the Google search engine console that you talked about before, I got
- 38:56a big pop-up that said, there's one of these domains I hadn't visited for a while.
- 39:00And it said, your site has now been switched to mobile first indexing.
- 39:06That's right.
- 39:06That's right.
- 39:07And one of the considerations is, does this page render good on a mobile phone?
- 39:13And they also think, when they think about performance, I think a lot of developers, they
- 39:17think, okay, and I totally count myself among this group in the early days.
- 39:21And I'd like to hear your thoughts as well as I go and I hit the server.
- 39:25How fast is the database?
- 39:26How fast is Pyramid, Flash, Django, whatever, getting out the door?
- 39:30Like, how quick am I getting like first byte to user, basically?
- 39:34And then that's kind of like, I'm done.
- 39:36Like, I've solved it.
- 39:37Like, now it's down to the browser to deal, right?
- 39:39Yeah.
- 39:40But that's just the beginning, right?
- 39:42That's what you learn, apparently, when you try to like start doing this analysis.
- 39:46Oh, my goodness.
- 39:47Yeah.
- 39:48I did my stuff.
- 39:49My stuff is a static page.
- 39:50So like, I was like, oh, yeah, this is awesome.
- 39:52It just loads the page.
- 39:54It's going to blaze.
- 39:55There's nothing else to worry about.
- 39:56One millisecond.
- 39:57We're good.
- 39:57I'm good.
- 39:59So what did you get when you first put it into the PageSpeed Insights, which is like
- 40:02the hosted version of Lighthouse?
- 40:04Do you remember?
- 40:04I was probably like in the 60s.
- 40:07Yeah.
- 40:07Or something like that.
- 40:08And so that has a ranking zero to 100, right?
- 40:11Yeah, exactly.
- 40:12So zero to 100.
- 40:12I put training.talkpython.fm in there and then talkpython and then Python bytes and whatnot.
- 40:17And those sites are crazy fast in the way I described.
- 40:21Like the database, the first byte out of the server is really fast.
- 40:25It's like totally reasonable to have a page that's 10 milliseconds.
- 40:28And I'm like, well, how could it possibly be slow?
- 40:30So let's see what amazing numbers I get if I throw it in here.
- 40:33And I got like 50.
- 40:34And it says, which is on the bottom end of moderately slow.
- 40:38And I'm like, what is that?
- 40:40What is this?
- 40:41What is going on?
- 40:43And so I spent three days going through the recommendations, like three eight-hour days
- 40:47working on one of the sites.
- 40:48And now I've got it up to, if I go to training.talkpython.fm, on mobile, I get 94.
- 40:53And on desktop, I get 100.
- 40:54Cool.
- 40:55Yeah.
- 40:55Nice.
- 40:55I'm in the 90s as well now, finally.
- 40:57Yeah.
- 40:57And there's flexibility, right?
- 40:59Like if the server hasn't requested a page, it might be a slightly, there's like, there's
- 41:03some variability here.
- 41:04And it's even if you just rerun it.
- 41:05But what's interesting is the 94 is the mobile version, like how fast can't, if you've got
- 41:12an image that has to be resized, it's one thing to do it on a high-end desktop.
- 41:14But if the phone has to resize it, that's going to hurt your ranking because it's like computationally
- 41:20slow for the phone to render the page.
- 41:22And there's all these different layers of stuff that you've got to look at.
- 41:26I mean, if you just loaded the image itself the wrong size, it's bigger.
- 41:30So you just sent the phone extra data that it's not really needed, right?
- 41:35Yeah.
- 41:35So to stick with it, so there's a few pieces here to stick with the images.
- 41:38So the first thing that the Google stuff recommends is to use WebP as the format, not PNG, not JPEG,
- 41:46as a compression format for your images.
- 41:48And that's great.
- 41:49It works great.
- 41:49It's, you know, it's usually lower image sizes, which is why they recommend it.
- 41:54It's Google's proprietary image format, right?
- 41:58That's right.
- 41:58Of course they're going to recommend it.
- 42:00So I was like, I did all this.
- 42:01I'm like, I got my stuff into the 90s.
- 42:03We'll get to the rest of it in a minute.
- 42:04I'm like talking to a buddy at work that also runs some websites and stuff.
- 42:09And he pulls out his iPhone and goes to my website.
- 42:12It's like, oh, that's cool.
- 42:13Yeah, yeah.
- 42:14Hey, what's up with your images?
- 42:15I'm like, what do you mean?
- 42:17Safari doesn't render WebP because Apple, right?
- 42:21Yeah.
- 42:22So that leads to you, in order to do this correctly, you can no longer use the image
- 42:28tag.
- 42:29You have to use the picture tag.
- 42:30There's a picture tag?
- 42:31This is like totally changing my, like blowing my mind.
- 42:33Yes.
- 42:34And the picture tag has fallbacks.
- 42:36Okay.
- 42:37So I'm trying to find the good one I have on my site.
- 42:40But essentially, you can specify a list of images and you say, if the screen size is of
- 42:47this many pixels, load this image.
- 42:49If it's of this many pixels, load this image.
- 42:51If the, you know, whatever.
- 42:52And then in the end, if you can't load any of those, load this image.
- 42:55So I had like, so for every image in my website, and that's important for me.
- 43:00So in Dragset Pass, we do illustrations and they come on.
- 43:04Like, I'm like, I want to load, you know, the 4,000 pixel illustration because it's really
- 43:08nice, right?
- 43:09Yeah.
- 43:09But obviously I can't.
- 43:10So I have four different files for every image.
- 43:13Each one optimized, you know, there's like a one at like,
- 43:16I think it's 1280 pixels.
- 43:19I do one in the 800s and one in the 400s.
- 43:22And then I automatically pick which one to use with the picture tag.
- 43:26And then I also have a PNG format for the people that are using Safari to render it.
- 43:31Yeah.
- 43:31That sounds really tricky, right?
- 43:33Because now you've got to have all these different types.
- 43:36And then how do you know about like the 404 missing image?
- 43:39Because you viewed it on a device that supports that.
- 43:41It selected a different format and whatnot.
- 43:45Yeah.
- 43:45Yeah.
- 43:45So I haven't gone down that path on the...
- 43:48I was going to export it to JPEG with a slightly lower quality and make sure the sizes...
- 43:52Like I might have multiple sizes that are all JPEG or like one's PNG and a bunch are smaller.
- 43:56Sure.
- 43:57But I don't know.
- 43:58Like the varied support, it just threw me off.
- 44:02I'm just like, I just don't know that I want to go down this path of having like unsupported
- 44:06image types that I've got to swap out, take care of.
- 44:08Yeah.
- 44:09That was an interesting adventure for me.
- 44:11Continuing down that, you get the screen optimizations and the fallbacks with the picture tag.
- 44:15Yeah.
- 44:16But outside of images, right?
- 44:18These days, people use CDNs a lot to load things that run on their website.
- 44:23So I have delivered a static webpage and I need jQuery to do something.
- 44:27I go link to some CDN that has jQuery.
- 44:30Well, that's yet another connection that client's browser needs to open.
- 44:34And that connection is going to open to a different server, which means you guys know how this works,
- 44:39right?
- 44:39If I went to tracksetpaths.org, I did a DNS query to figure out what IP address it was, open
- 44:45a TCP connection, download some data.
- 44:48If I'm talking about JavaScript, I'm then parsing that and loading it up, right?
- 44:54Right.
- 44:54Well, now if I have an extra script tag in there, now I have to do that same thing for
- 45:01whatever DNS is providing, whatever domain is providing that.
- 45:04So if that's coming from, you know, Google Fonts, right?
- 45:07So that's got to do the DNS query, open up Google Fonts, download the font, do whatever
- 45:12parsing and show it in the website.
- 45:13So for every CSS or script or external thing that loads into your page, you're doing all of
- 45:19these things and that has an impact and that actually shows up.
- 45:23And it counts against you regardless of whether it's a CDN link, a second link on your site
- 45:29or like, it's just number of connections we got to do.
- 45:31The more, the worse.
- 45:32Yeah.
- 45:33It's more work for the client, for the browser, right?
- 45:36Yeah.
- 45:36So in order to help that around, there's a number of things that you can do in your header,
- 45:42in your HTML that will serve as preloads.
- 45:47So there's a couple of different commands.
- 45:49There's the link tag, like you would add a style sheet or whatnot, but there's also, there's
- 45:56a rel property that you can set to preload or pre-connect.
- 46:00And pre-connect means do the domain name resolution.
- 46:04So that means you do that once because ahead of time, like for example, the Google Analytics
- 46:09that git added to my website, I do a pre-connect to Google Analytics so that that, all of that
- 46:16is resolved.
- 46:16The TCP connection is already open at the start of the page.
- 46:19And by the time it makes it all the way to the bottom and actually needs to load something,
- 46:23it just needs to go and get data versus having to.
- 46:26Right.
- 46:26It's probably done the DNS resolve and actually already done the SSL exchange.
- 46:30That's right.
- 46:31The port opening to the server even maybe.
- 46:34That's right.
- 46:35And for that one, I needed to pre-connect because the get changes slightly.
- 46:42I'm looking at dumping the whole Google Analytics stuff.
- 46:44So at some point that, that's a different conversation we should also have.
- 46:47I've since dumped them.
- 46:49So yeah, I hear you.
- 46:49There's also a preload command you can give out, which actually essentially just loads the
- 46:55file that you say.
- 46:56It just loads it and keeps it in memory.
- 46:58It doesn't use it immediately.
- 47:00It's just there.
- 47:01And then when you run into it in the rest of the document, then it uses it.
- 47:04So I use that for like the fonts.
- 47:06The fonts get preloaded and some JavaScript gets preloaded and stuff like that.
- 47:09Yeah.
- 47:10I just recently saw my first page that was like full of these preloads and pre-connects.
- 47:14And I'm like, oh, this is the thing that I didn't know about.
- 47:16How interesting.
- 47:17And it's clearly like, we're going to set this up and fire these off.
- 47:20And like, as soon as you can get them, as soon as you got a break and loading stuff,
- 47:23go get these.
- 47:24And yeah, that seems pretty cool.
- 47:26Another one that will probably basically not help you on PageSpeed, on the Google PageSpeed
- 47:33site, but will really make your users happy is just browser caching.
- 47:37Yes.
- 47:37And there's different aspects of that and different problems that it generates.
- 47:41You can give the browser instructions on what to cache and how long to cache it for.
- 47:48Yeah.
- 47:49And the PageSpeed stuff actually takes that into consideration for how long you're caching
- 47:53things.
- 47:53Yeah.
- 47:53I actually took advantage.
- 47:55So I have like a set default kind of thing, but I also took advantage of using, I use Cloud
- 48:01Flare in front of the website.
- 48:02So I can dynamically change that in Cloud Flare depending on what it is.
- 48:06So I can add like rules that say, well, tell our clients to cache the images for a year,
- 48:12right?
- 48:13Because I'm not going to change the image for an article.
- 48:15Right.
- 48:16But only cache the HTML for a week or something like that.
- 48:19Yeah.
- 48:19Interesting.
- 48:21Yeah.
- 48:21On mine, I have it.
- 48:22Every CSS, JavaScript, image, everything is cached, I think for a year.
- 48:26Yeah.
- 48:27And they recommend the really high number.
- 48:29Yeah.
- 48:29And it's really good in terms like speed.
- 48:31Like I was at a hotel in Israel and trying to get back to some sites.
- 48:36So they were all just dragging.
- 48:38And mine is like zip, zip, zip, because it just exchanges just the HTML and nothing else.
- 48:43Right.
- 48:44One connection, everything else is out of the browser.
- 48:46Like this is really super cool.
- 48:48Is it working well?
- 48:48The problem is if you change anything, like you update your style, then it's all busted,
- 48:54right?
- 48:54That's where a question mark and some hash comes into play.
- 48:59I have a whole infrastructure that says, here's the URL and on the server side, generate a hash,
- 49:05like cache ID equals whatever the hash is.
- 49:08And if that file changes, it's going to rehash it.
- 49:10So it's an entirely different thing that's cached, again, for a year.
- 49:13Like it might use up another 200K of somebody's browser cache, but who cares, right?
- 49:17It's memories cheap.
- 49:18Yeah, sure.
- 49:19So on that, right, there's, aside from the caching, right, don't forget that any JavaScript
- 49:26or CSS that you give out to your customers, you want that to be minimized, right?
- 49:35And that means, what does minimization mean?
- 49:38That means removes all of the spaces, for example.
- 49:42Yeah.
- 49:42You also want fuelification, which is a bundle.
- 49:45That's right.
- 49:46You want less of them and you want them to be smaller, taken as an aggregate.
- 49:50That's right.
- 49:51And so then like there are minimizers.
- 49:53Google has a tool that you can use for minimizing CSS and JavaScript.
- 49:58And it's not just removing spaces, but it also, like in the case of JavaScript, it'll rename
- 50:03all your variables.
- 50:04Oh, interesting.
- 50:04Okay.
- 50:05So it does a little bit of obfuscation, right?
- 50:07So if you have a, like as a developer, you want to have descriptive variables, but the
- 50:11tools will actually take that variable name down to one letter as much as you can.
- 50:16Okay.
- 50:17So you'll find your users.username, users.email, whatever can turn into A.B.A.C.
- 50:24Right.
- 50:25Right, right.
- 50:25Yeah.
- 50:26Which can be significant.
- 50:27Yeah.
- 50:28For the right app.
- 50:29Just the whole point of that is to reduce the size of the file that you're transferring
- 50:33to the clients.
- 50:35Right.
- 50:35Right.
- 50:35You want to reduce the size.
- 50:37And if you can, you want to bundle them.
- 50:38That doesn't always work because sometimes like the JavaScript might refer to a relative
- 50:43path back to like an image or a CSS file or something.
- 50:48And then like if you bundle them up, up the directory, then they get all broken.
- 50:51I had something like that with font awesome.
- 50:53I had to stop.
- 50:54I'd like unbundle font awesome or something because it was, it couldn't find pieces of itself.
- 50:58There's some tricky stuff as it refers between files.
- 51:01Yes.
- 51:01But theoretically, which is contrary to usual programming practices, the more that you can
- 51:08put all of this stuff in the one file, right?
- 51:11So if you can combine, so there's a, the tools will do that for you too.
- 51:15If you load jQuery and font awesome and, you know, bootstrap and a bunch of JavaScript and
- 51:21then the JavaScript for your website, you can run it for these tools and it'll put everything
- 51:25into one file and then minimize it.
- 51:27Yeah.
- 51:27And so then you're transferring one thing, which means one TCP connection, one request,
- 51:31and you're just moving data back.
- 51:32Well, let's say one thing that I came across and started using exactly in this space when
- 51:37I was going down the lighthouse thing, as I said, you're making 26 requests for JavaScript
- 51:41and CSS.
- 51:42Oh my gosh, I'm done.
- 51:44Like there's nothing I can do to like, how can I fix this?
- 51:47Right.
- 51:47And I knew about bundling, but I'm like, this is going to be a lot of trouble because I,
- 51:50I like to have small CSS files.
- 51:52Like this part of the site has its own CSS file.
- 51:54So it's not huge and I can reasonably deal with it.
- 51:56Right.
- 51:57But, but Google was hating on it because it's like, here's another request.
- 52:00I'm like, yeah, but it's cash for a year, but it doesn't matter.
- 52:03My page rank is what they say.
- 52:06And it's the first request, not the cash request.
- 52:08So whatever.
- 52:08Yep.
- 52:09Along those lines, there's a progressive web apps.
- 52:12Yeah.
- 52:12If folks have heard about that.
- 52:14So a track set pass is a PWA, progressive web app.
- 52:18I think that's, I might disable that, but what that does is it makes your, you can write a
- 52:24little bit of JavaScript that will make your website run even when your site is not online
- 52:29as much as possible.
- 52:30And it can be executed.
- 52:33Like if you're, you can actually make a shortcut to the site.
- 52:39So you'll have like a, an icon just for your site.
- 52:41You can just click it and it'll come online.
- 52:43And all that JavaScript does is it registers what they call a worker.
- 52:47And the, every request that the webpage makes for content goes through this worker essentially.
- 52:55And the worker, you can do whatever you want with it.
- 52:57But the main point is the worker keeps a local cache.
- 53:00And the worker knows what to pre-cache.
- 53:03So when your website comes online, it says load all these images for you.
- 53:06And then for every request, go get them and load it into a cache.
- 53:11It gets stored in local storage in your web pages.
- 53:14You can see it all in developer tools.
- 53:16And so then, you know, that makes your website run fast and you can even have an off, you'd
- 53:20have to have an offline page.
- 53:23So if you need to like fetch the content and you can't get to it, you can provide the users
- 53:26and like, oh, I can't get to the internet right now.
- 53:28This is what it looks like.
- 53:29Okay.
- 53:29Yeah.
- 53:29That's really cool.
- 53:30What I came across was this thing called web assets.
- 53:34All one word.
- 53:35Yeah.
- 53:36Yeah.
- 53:36Which is a Python library that does that bundling and minification you're talking about.
- 53:40It uses JS min and CSS min, which are Python packages that do that for JS and JavaScript
- 53:46and CSS.
- 53:47And so now when my site starts, it just does like a quick check.
- 53:52Hey, do I need to rebuild the one giant CSS and JavaScript files?
- 53:56So I don't have to remember to take it and like, oh, I forgot to run that.
- 54:00So that's out of date.
- 54:01Like, it's just like at the start, it goes, here's the hash of the files.
- 54:04Is there anything new?
- 54:05Let's regenerate them.
- 54:06And it's kind of just all automatic.
- 54:08Right.
- 54:08So that's a pretty good set of Python tools.
- 54:10Nice.
- 54:11Yeah.
- 54:11I knew about this at work.
- 54:12I actually hadn't thought about looking at that for the stuff I have at home for some
- 54:15reason.
- 54:15Yeah.
- 54:16I'll have to go.
- 54:16I'll have to go see.
- 54:17It might help me out with a few things.
- 54:19I have a really quick one that will totally help people.
- 54:21This one only works on macOS, but I think they link to other options on their site.
- 54:27An image optim.
- 54:29I am AJ, like image O-P-T-I-M.
- 54:32And what it is, is like a, just a collection of algorithms that do lossless recompression
- 54:40and re-encoding of images.
- 54:42Okay.
- 54:42Right.
- 54:43So like you visually, literally there's no visual change to what's happening, but it might
- 54:47re-encode it.
- 54:48Like it might change the color spectrum for a PNG because it realizes only 256 colors.
- 54:53Oh, that's pretty cool.
- 54:53Right.
- 54:54And so what you can do is you can take just the root of your website and throw it at this.
- 54:58It will traverse the directories, find all the things and in place, replace them with their
- 55:03optimized but unchanged version.
- 55:05Nice.
- 55:05That's pretty cool.
- 55:06Yeah.
- 55:07I did this on my sites and I got like 40% less.
- 55:10It went from like 20 megs of images to, I don't know, whatever that was like nine.
- 55:15And you just, it takes forever, but you just literally drag, drop, wait, done.
- 55:20Cool.
- 55:21I'll check it out.
- 55:22Yeah.
- 55:22So I was going to say on the image side, I use, I was talking about WebP earlier.
- 55:25I forgot to mention it.
- 55:26I use C WebP, which is, you can just go install it and it'll produce WebP images and you can
- 55:32have it resize the images for you.
- 55:33You feed it like a JPEG and PNG and it'll put out that kind.
- 55:38Yeah.
- 55:38And you can define what quality you want and what size you want for the image.
- 55:42So you even resize it automatically for you.
- 55:43Cool.
- 55:44Yeah.
- 55:44Those are, I like those because they're so easy.
- 55:46Like they take no work and they're like, as long as you got your stuff in GitHub, checked
- 55:49in, source control, like you're not in real danger of messing up stuff.
- 55:52Yeah.
- 55:52Yeah.
- 55:53That's right.
- 55:53That's right.
- 55:54Yeah.
- 55:54Yeah.
- 55:54All right, Chris, we're getting kind of closer to the end of the show, running short on time.
- 55:58I feel like we've just scratched the surface though, you know?
- 56:00Yeah.
- 56:00What else, like quickly, what else should we like point out for folks that they should go
- 56:04check out?
- 56:05We can talk about a few pieces.
- 56:07So in Google search, so okay.
- 56:10Trying to figure out which one works best.
- 56:13So you put a link in Twitter.
- 56:15Yeah.
- 56:15Twitter pulls up like a little card with an image and a little summary of the website or
- 56:20whatever it is that you like.
- 56:21Right.
- 56:21For the cool sites it does, right?
- 56:23Yeah.
- 56:24Right.
- 56:24Like ours, right?
- 56:25Exactly.
- 56:25So all that is configured through meta tags and there's actually a standard, there's
- 56:29a Twitter.
- 56:30It seems like Twitter came first or maybe just Twitter was different.
- 56:33Everyone else seemed to grab it or whatever, right?
- 56:35Yeah.
- 56:35There's a thing it's called Open Graph that describes a set of meta tags you can put into
- 56:42your website to provide a title, a description, a summary, what image you want to use for that
- 56:49little summary, a bunch of stuff like that and keywords as well, which is also important.
- 56:54So all those meta tags you have to put in there because not just it works for Twitter, but it
- 56:58works for your search engine and as part of the rankings.
- 57:02Yeah, that's awesome.
- 57:04And it definitely helps your stuff look more professional and anybody happens to grab it
- 57:07and share it on social, right?
- 57:09It's got this cool visual, like you've structured how it looks rather than just depending on like
- 57:13a weird truncated URL.
- 57:14Yeah, exactly.
- 57:15And along the same lines, there's actually a whole other standard called JSON-LD, which is
- 57:23used to essentially provide a JSON version of the stuff in your website, in your page.
- 57:31So for example, when you go to Tri-Set Pass, in the main index, I can say, I am a website
- 57:41of articles and here are all the articles and the titles and links and all that stuff.
- 57:46Oh, wow.
- 57:46Okay.
- 57:47So that's parsed by search engines.
- 57:49But not just that.
- 57:50That information is actually used to generate the little cards that show up in the Google
- 57:55searches.
- 57:55You know, if you search for a recipe, it'll sometimes have the little...
- 57:59Right, right, right.
- 57:59All of that stuff has higher priority than the rest of the content because it shows up
- 58:04up top in your search results, right?
- 58:07And that is actually used if you go to the Google Search Console.
- 58:10There's a little discovery section on the left side, which is part of like if you're on an
- 58:15Android device and it's one of the Google built-in things in there and it shows content that Google
- 58:21thinks you'd be interested in, if you have these things available, then it shows up in
- 58:27discovery a little bit more.
- 58:28Oh, cool.
- 58:29You can characterize your website with it.
- 58:31You can say it's articles, it's recipes, it's video or whatever.
- 58:34There's like all this stuff to help do that.
- 58:36Okay.
- 58:37Awesome.
- 58:38Yeah.
- 58:38So that's JSON-LD, huh?
- 58:40That was a piece that's important.
- 58:41JSON-LD.
- 58:42Yeah.
- 58:43I'll put that in the show notes as well so people can have that.
- 58:45Oh, man.
- 58:46So many things.
- 58:47It's so awesome.
- 58:47And the thing is, it's rewarding if you get this right, people just engage with you and
- 58:52your content more or your products or whatever.
- 58:54And it's awesome.
- 58:55Yep.
- 58:55Exactly.
- 58:56All right, Chris.
- 58:57Cool.
- 58:57I should leave it here.
- 58:57But maybe it'll have to be a second edition to dive deeper into this.
- 59:02But before you get out of here, you got to answer the two questions again.
- 59:05You're right.
- 59:06Some Python code.
- 59:06What editor do you use?
- 59:07I'm on VS Code these days.
- 59:09Loving the remote extension.
- 59:10Oh, yeah.
- 59:11That's super cool.
- 59:12I wanted to start using that as well some more.
- 59:14I probably will.
- 59:15I was talking about redoing my servers.
- 59:16Maybe it's the time to get like a little hook for that in there as well.
- 59:19Yeah.
- 59:19And then notable PyPI package.
- 59:22I'm using unsync these days a little bit.
- 59:24I know you like that one.
- 59:25I'm all about unsync.
- 59:27I love that.
- 59:27It's like awesomeness per line of Python code.
- 59:30Can't be beat.
- 59:31Yep.
- 59:31It's a really nice one.
- 59:32Awesome.
- 59:32Yeah.
- 59:33So basically, it's a unifying API across threaded parallelism, multiprocessing parallelism,
- 59:40and async ILO.
- 59:41Yep.
- 59:42And a slightly better API for all of them.
- 59:44Right.
- 59:44And one.
- 59:45Yeah, exactly.
- 59:45It's so, so clean.
- 59:47It's really nice.
- 59:47I love it.
- 59:48Really simple.
- 59:48Great recommendation.
- 59:49Yeah.
- 59:49All right.
- 59:50Final call to action.
- 59:50People want to, like, they've got their site.
- 59:53Maybe they just threw it into PageSpeed and they're like, how could it be 54?
- 59:56This is, I can't believe it's 54.
- 59:59Or, you know, they saw something crazy in the search console.
- 1:00:02They want to take some action, make this better, get their stuff to rank better.
- 1:00:05What do they do?
- 1:00:05If you're using PageSpeed, just take advantage of the actual output.
- 1:00:09It's really descriptive.
- 1:00:10There's links to all the documentation, why all of the things matter.
- 1:00:13Just, like, take your time and go through it and start optimizing.
- 1:00:17You'll probably be able to get a bunch out of just optimizing images first.
- 1:00:21So you can prioritize stuff like that.
- 1:00:23Then you can head over to the JavaScript stuff.
- 1:00:25And then you can start looking at the connections and whatnot.
- 1:00:28I think reading through the Moz guide, which is a long guide, we'll link in the show notes,
- 1:00:34is very useful.
- 1:00:36Remember, producing a good website not only makes more people come to it,
- 1:00:40though, you know, people will be happier with it.
- 1:00:42It'll seem responsive and more professional, right?
- 1:00:45I agree.
- 1:00:46Yeah, all these things help SEO, but most of them also help the users directly.
- 1:00:50Yeah, that's right.
- 1:00:51Awesome.
- 1:00:51Happy users is a good thing.
- 1:00:52That's for sure.
- 1:00:53All right.
- 1:00:54Well, Chris, it's been great to have you back on the show.
- 1:00:56Until next time.
- 1:00:57Thanks for having me.
- 1:00:58Yeah, you bet.
- 1:00:58Bye-bye.
- 1:00:58Catch you later.
- 1:00:59Bye.
- 1:01:00This has been another episode of Talk Python To Me.
- 1:01:04Our guest on this episode was Chris Medina, and it's been brought to you by Kite and Linode.
- 1:01:08Kite is the smart, AI-powered autocomplete for your editor.
- 1:01:12And the more powerful your editor is, the more effective that you are.
- 1:01:16Get Kite for free at talkpython.fm/kite.
- 1:01:19Start your next Python project on Linode's state-of-the-art cloud service.
- 1:01:24Just visit talkpython.fm/Linode, L-I-N-O-D-E.
- 1:01:28You'll automatically get a $20 credit when you create a new account.
- 1:01:33Want to level up your Python?
- 1:01:34If you're just getting started, try my Python Jumpstart by Building 10 Apps course.
- 1:01:39Or if you're looking for something more advanced, check out our new async course that digs into
- 1:01:44all the different types of async programming you can do in Python.
- 1:01:47And of course, if you're interested in more than one of these, be sure to check out our
- 1:01:51Everything Bundle.
- 1:01:52It's like a subscription that never expires.
- 1:01:54Be sure to subscribe to the show.
- 1:01:56Open your favorite podcatcher and search for Python.
- 1:01:58We should be right at the top.
- 1:01:59You can also find the iTunes feed at /itunes, the Google Play feed at /play,
- 1:02:04and the direct RSS feed at /rss on talkpython.fm.
- 1:02:08This is your host, Michael Kennedy.
- 1:02:10Thanks so much for listening.
- 1:02:12I really appreciate it.
- 1:02:13Now get out there and write some Python code.
- 1:02:15I really appreciate it.