Website Optimization Measures, Part IX
Post from November 14, 2019, filed under Web Development.
Welcome to another post in a long-standing series of random acts of website optimization, acts that are inspired by the work I’m performing on my own sites. Given the various activities needed to operate websites I often forget documenting improvements for this series, however this is what stood out over the last few months.
Improving server-side compression and caching. I’ve just cussed that I didn’t take notes about the exact optimizations. As far as I recall it was mostly about adding to what’s going to be compressed, and what’s going to be cached for how long, likely resulting in the following lines for my Apache setups:
The very short story for the relatively short caching periods: For smaller projects I’m still passionately skeptical about “versioning.”
Setting up content security policies (CSPs). The most advanced project to do this for was certainly this very site, leading to the following .htaccess line:
Header always set Content-Security-Policy "default-src 'self'; img-src 'self' *.amazon.com *.buysellads.net *.creativecommons.org *.doubleclick.net *.eyeem.com *.met.vgwort.de *.tumblr.com *.w3.org; script-src 'self' cdn.carbonads.com srv.carbonads.net; style-src 'self' 'unsafe-inline' *.w3.org"
Removing Web Sign-In markup. I like the ideas for and people behind the IndieWeb but playing with some of the markup, I found it didn’t add enough value. I removed it.
Updating http links to https. I connected routine link checks with this little performance (skipping a http–https redirect) and security improvement (ensuring a more secure connection in absence of HSTS and redirects). This one has greatly benefited the users of UITest.com.
&entity references. Escaping
&is rarely necessary anymore, and I replaced most
&. Upgrade Your HTML has a short chapter about the topic.
Implementing feature policies. I played with feature policies and found I could just block some more invasive features for my websites, features I wouldn’t want to make use of anyway:
Header always set Feature-Policy "camera 'none'; geolocation 'none'; microphone 'none'; payment 'none'"
Do you have a nicer standard setup?
Converting GIFs to PNGs. You get better compression results with PNGs than with GIFs and for some reason I still had a few GIFs hanging around in live projects. I converted and compressed that remainder in a swift manual operation using Preview/GIMP and ImageOptim.
Dropping ISBNs from paths (and obeying proper ISBN formatting). 14 years ago I had this idea that I should include (alas falsely formatted) ISBNs in the paths of my German book pages. That tradition held until a few weeks ago, when I learned about the correct formatting for ISBNs but decided that book names were far better (SEO, independence of identifiers) for respective pages’ URL slugs than these numbers.
I’m Jens Oliver Meiert, and I’m a web developer and author. I love trying things, including in the fields of philosophy, art, and adventure. Here on meiert.com I share some of my views and experiences.
If you have any suggestions or questions about what I write, leave a comment or a message.
Have a look at the most popular posts, possibly including:
Perhaps my most relevant book: CSS Optimization Basics (2018). Writing CSS is a craft. As craftspeople we strive to write high quality CSS. In CSS Optimization Basics I lay out some of the most important aspects of such CSS. (Also available in a bundle with Upgrade Your HTML.)
Looking for a way to comment? Comments have been disabled, unfortunately.