皆さん、こんにちは!モルダモルキです。
PageSpeed Insights(略してPSI)は、Webサイトの読み込み速度や、ユーザーが快適に利用できるかどうかを測定するGoogleのツールです。
私はGoogle Site Kitという、サイトのアクセス状況などを確認できるツールも使いながら、なるべくサイトの表示速度を落とさないように、これまで何度も格闘してきました(笑)😅
今回は、これまで私が試してきたことを少し振り返ってみたいと思います。
サイトを運営していて、表示速度を改善したいと思っている方の参考になれば嬉しいです。
なお、私は技術的な部分に詳しいわけではありません。AIたちに相談しながら、分からないことも多い中で試行錯誤してきた記録です。
最初に試したのは、JavaScriptやCSSを圧縮・最適化するプラグインの導入でした。
プラグインは、WordPressに新しい機能などを追加するためのプログラムです。
JavaScriptは、Webサイトに動きや機能を加えるためのプログラム言語です。CSSは、文字の色や大きさ、ページのレイアウトなど、デザインを指定するためのコードです。
これらを圧縮・最適化することで、サイトの読み込み速度が改善する場合があります。
ところが、私のサイトでは、セキュリティ関連のプラグインと併用した際に管理画面へアクセスできなくなる問題が発生しました。
そのため、こうしたプラグインの継続利用を見送ることにしました。
また、私のサイトには、AIと一緒に作ってきた3Dテーマパークなど、独自のコードがたくさんあります。最適化の設定によっては、サイトの表示や動作に影響が出る可能性もあります。
こうした事情もあり、プラグインに頼って一括で圧縮するのではなく、ほかの方法で速度改善に取り組むことにしました。
次に取り組んだのが、画像の保存形式の見直しです。
当初はPNG形式で保存していた画像も多かったのですが、PNGよりもファイルサイズを小さくできる場合があるWebP(ウェッピー)形式に変更しました。
画像のファイルサイズを小さくできれば、ダウンロードに必要なデータ量を減らし、読み込みの負担を軽くできる可能性があります。
当時は「EWWW Image Optimizer」というWordPressのプラグインも活用しました。画像の圧縮やWebP形式への変換などを支援してくれるツールです。
現在は、写真やイラストなどの画像をWebP形式に変換してからWordPressにアップロードするようにしています。
ただし、WebPにすれば必ずファイルサイズが小さくなるというわけではありません。画像の内容や圧縮設定によっても結果は変わります。
画像の見直しなどに取り組んだ後、しばらくの間はPageSpeed Insightsを確認していませんでした。
ところが、久し振りに測定してみると、数値が再び悪化していました。
そこで次に取り組んだのが、カスタムCSSやPHPコードの見直しです。
カスタムCSSは、サイトのデザインやレイアウトを変更するためのコードです。また、functions.phpは、WordPressのテーマ(サイトのデザインや基本的な表示の仕組みを決めるもの)に機能や処理を追加するためのファイルです。
同じような処理が重複していないか、不要なコードが残っていないかなどをAIに相談しながら確認し、無駄を減らすようにしました。
ただし、コードを整理すれば必ず表示速度が改善するとは限りません。サイトの構成によっては、速度への影響が小さい場合もあります。
それでも、コードを整理しておくことは、今後の修正やメンテナンスを進めやすくするうえでも大切だと感じました。
YouTubeの動画をWebサイトに埋め込むと、動画を表示・再生するために、YouTube側のプログラムなども読み込まれます。
そこで試したのが、ファサード表示と呼ばれる方法です。
これは、最初から動画プレーヤーを読み込むのではなく、まずサムネイル画像などを表示しておき、ユーザーがクリックした段階で動画プレーヤーを読み込む仕組みです。
こうすることで、ページを開いた直後に読み込むデータや処理を減らせる場合があります。
動画をたくさん埋め込んでいるページでは、こうした工夫も重要になりそうです。
これまでに取り組んできたことは、ほかにもあります。
- 自作ヘッダーアニメーションの軽量化
- ロリポップ!アクセラレータの有効化
- 画像の遅延読み込み
- WPCodeのスニペットの編集と有効化
- ページの背景画像やフォントの読み込み方法の見直し
などなど。
PageSpeed Insightsの数値が下がるたびにAIたちに相談し、分からないことを調べながら、その都度できそうな対策を試してきました。
ただ、PageSpeed Insightsの数値は測定するたびに変動することがあります。そのため、対策を行った後に数値が改善しても、それだけで特定の対策が原因だったと断定することはできません。
変更前と変更後の数値を複数回確認しながら、慎重に判断する必要があります。
サイトの表示速度を改善する作業は、目に見えにくく、変化に気付いてもらうことも少ないかもしれません。
しかし、サイトを快適に利用してもらうためには、コンテンツを増やすだけでなく、こうした裏側のメンテナンスも大切なのだと感じます。
もちろん、サイトの構成や使用しているプラグインによって、効果のある対策は異なります。また、設定を変更することで、サイトの表示や動作に影響が出ることもあります。
変更前の状態を記録し、問題が起きたときに元に戻せるようにしておくことも大切ですね。
今後もPageSpeed Insightsの数値を確認しながら、AIたちと格闘していきたいと思います😅
ChatGPTとクロードがまとめてくれた速度改善に関する記事はこちら
🏃♀️➡️ WordPress PSI LCP Preload
Hello, everyone! I'm Molda Molki!
PageSpeed Insights (PSI for short) is a Google tool that measures a website's loading speed and other aspects of the user experience.
I also use a tool called Google Site Kit to check my website's traffic and other statistics. I've spent quite a bit of time trying to keep my website running smoothly and improve its loading speed. 😅
Today, I'd like to look back at some of the things I've tried so far.
I hope my experience will be helpful to anyone who runs a website and wants to improve its loading speed.
I'm not an expert in web technology, though. This is a record of my trial and error as I consulted AI for advice and tried different solutions, often while still figuring things out myself.
The first thing I tried was installing a plugin to compress and optimize JavaScript and CSS.
A plugin is a program that adds new features and functionality to WordPress.
JavaScript is a programming language used to add interactive features and behavior to websites. CSS is code that controls a website's design, including text colors, font sizes, and page layouts.
Compressing and optimizing these can sometimes help a website load faster.
However, on my website, using this type of plugin alongside a security-related plugin caused a problem that prevented me from accessing the WordPress admin dashboard.
As a result, I decided not to continue using this type of plugin.
My website also contains a lot of custom code that I've created with the help of AI, including an interactive 3D theme park. Depending on the optimization settings, this code could affect how the website looks or functions.
For these reasons, I decided to explore other ways to improve loading speed rather than relying on a plugin to compress everything at once.
The next thing I worked on was changing how I saved my images.
Originally, I had many images saved in PNG format. I started switching to WebP, a format that can produce smaller file sizes than PNG in some cases.
Smaller image files mean less data needs to be downloaded, which can help reduce the work required to load a page.
At the time, I also used a WordPress plugin called EWWW Image Optimizer. It helps with image compression and converting images to WebP format.
These days, I convert photos, illustrations, and other images to WebP before uploading them to WordPress.
However, WebP doesn't always produce smaller files. The results depend on the image itself and the compression settings.
After reviewing my images and making other improvements, I stopped checking PageSpeed Insights for a few months.
When I eventually checked it again, the scores had gotten worse.
So, my next step was to review my custom CSS and PHP code.
Custom CSS is code used to change a website's design and layout. The functions.php file is used to add features and functionality to a WordPress theme, which determines a website's design and basic display structure.
With help from AI, I checked for duplicate processes and unnecessary code, looking for ways to simplify things.
Cleaning up code doesn't necessarily make a website faster. Depending on how the site is built, the impact on loading speed may be small.
Even so, I found that keeping my code organized is important because it makes future updates and maintenance easier.
When you embed a YouTube video on a website, the page also needs to load scripts and other resources used to display and play the video.
One solution I tried was a technique called a facade.
Instead of loading the video player immediately, this method initially displays a thumbnail image or similar preview. The actual video player is loaded only after the visitor clicks it.
This can reduce the amount of data and processing needed when the page first opens.
This kind of optimization may be especially useful for pages that contain lots of embedded videos.
I've also worked on several other things, including:
- Making my custom header animation lighter
- Enabling Lolipop! Accelerator
- Lazy-loading images
- Editing and enabling WPCode snippets
- Reviewing how background images and fonts are loaded
And more!
Whenever my PageSpeed Insights scores dropped, I asked AI for advice, researched what I didn't understand, and tried whatever solutions seemed worth testing.
However, PageSpeed Insights scores can fluctuate between measurements. So even if a score improves after making a change, I can't automatically conclude that the change was responsible.
It's important to check the results several times before and after making changes and evaluate them carefully.
Improvements to loading speed aren't always visible, and visitors may not even notice the changes.
Still, I've come to realize that maintaining a website behind the scenes is just as important as adding new content if I want people to enjoy using it.
Of course, the best solutions vary depending on how a website is built and which plugins it uses. Changing certain settings can also affect how a site looks or functions.
It's important to keep a record of the original settings so that I can restore them if something goes wrong.
I'll keep checking my PageSpeed Insights scores and continue battling loading-speed issues alongside my AI companions! 😅
You can read the detailed article on website speed optimization, put together with the help of ChatGPT and Claude, here:
🏃♀️➡️ WordPress PSI LCP Preload



コメント