In ancient Greek religion and mythology, the Muses are the inspirational goddesses of literature, science, and the arts.
My father-in-law and I started this science blog during the 2020 pandemic as a way to learn more about the world, together. There are over 60 videos that we've shared so far and it's one of my favorite things to do on the weekends! I also challenged myself to reach a perfect Lighthouse audit score. There aren't any images loaded on the site (until you reach a video), and every animation you see is made from CSS.
Performance
The first step to any performant website is to have static content. It's almost impossible to have a perfect 100 score with a coupled site since there is a dependency on the back-end to process the front-end. Celestial Lite was the tool of choice for this project. Static files generated by NodeJS allowed the freedom of backend-templating style coding through Javascript. Since all your files are created at build time, the server doesn't need to do any additional processing to serve your website.
The second step is to remove as many network calls as possible. Inline your CSS, inline your JS, and swap out your images for SVGs if possible. Every call you make, even if preloaded and synchronous, is time that your site takes to show to your users.
The third and final step is to serve your entire site from a global CDN. This is what they excel at, so take advantage of their scale and reach to load your site as quickly as possible.
Accessibility
Accessibility is one of the most important features of a website that is typically pushed aside. Being able to navigate through the web should never be difficult, and as developers, it should be one of our top priorities to make the journey as painless as possible. By using javascript frameworks such as React or Angular, it's easy to miss some of the standard HTML accessibility features such as focus states, keyboard events, and standard tags.
Using standard <h1> - <h6>
tags helps screen readers, and SEO, read and organize your content appropriately. Images should have useful alt text, and buttons should have aria-labels if their text is not clearly defined.
Landmarks are another important feature that allow screen readers to jump to the most important content, such as the <header>
, <main>
, and <footer>
tags.
Best Practices
This section is a mixture of obvious things such as using a <doctype>
, SSL certificate for the domain, and a list of things that I would classify under the "ethical developer" tips category.
Zach's Ethical Developer Tips
- Don't request geolocation on load. It's a little rude.
- Don't request notifications on load. See above.
- Don't block users from pasting into form fields.
- Don't hijack the scrollbar.
- Don't rebind key events unless you built an app specific to that.
There are a few others like "don't use third party scripts" but nowadays that's pretty difficult to do.
SEO
Getting your <meta>
and <link>
ducks in a row can easily put you ahead of the game. The basics include:
- Title tag (Always include a title tag...)
- Meta Description
- Open Graph - my favorite
- Meta Theme for mobile browsers
- Link - Apple icons
- And a Manifest.JSON file
Even though Google claims its bot can crawl Javascript rendered pages, its hard to beat statically rendered content. Plus, all of your links can quickly be crawled without it running into any javascript errors.
In Conclusion
A perfect score is attainable, and doesn't always have to be a bare-bones website (though sometimes that's a better idea than it sounds). With a strong focus on accessibility, and semantic HTML, you too can have a perfect score.
If you want more, check it out for yourself!
Finito! (The End)
Thanks for reading!