So I discovered this week that I don't wanna do SEO. Again, ideally things would be built baked in but I do love checking things off and seeing little green checkmarks, or in this case a green 100 score in Lighthouse for SEO. It was pretty easy to implement so hopefully my site does just that. Perhaps there's more to it as there are whole careers dedicated to SEO.
So first off, I created an SEO component, meshing the examples from GitHub and a GatsbyJS article. When added, this component essentially adds a <Helmet /> component to each page, injecting it with relevant metadata tags to drive up its rank in SEO.
Nextly, I created a structured data snippet to include into my Helmet/SEO component. I didn't know what the hell structured data was but Gatsby explains it nicely. It seems to me like a JSON formatted data file (it's actually JSON-LD) that uses specific name tags like "@context" and "@type" so that search engines, namely the old Goog', knows what your site/webpage is on about. This syntax reminds of the data within the Gatsby developer environment, in the package*.json files–but I digress.
I wrap that juicy structured data in a <script> tag and finally include it within my component. And hopefully, fingers crossed, it works.
The next step to this was relatively easy. Read an article and install a plugin. Thank [insert name of deity] for Gatsby's many plugins that makes life easier.
I installed gatsby-plugin-advanced-sitemap. Chucked that into gatsby-config.js and viola, a sitemap. Unfortunately, you won't see it until you hit gatsby build, but that's part of the fun I suppose.
I noticed within Lighthouse audits it's telling me that I should have a robots.txt file for the search engine robots that crawl the web. So naturally, I look for the plugin and install that as well.
Thank our lord and saviour, Cthulhu.
I hit build, and published my site to my CDN (currently Netlify) so I can assess the SEO of the deployed site. To my knowledge, you can't really assess it locally as for me it says:
... which makes sense.
And while I don't like the idea of enhancing a site's SEO for discoverability, I did enjoy learning about it. And yes, the GREEN 100 on Lighthouse was well worth it :)
Comments
Add comment