FTP管理のデブログをWordPress管理にしました♪

フカボリ

FTP管理かんりのデブログをWordPress管理かんりにしました♪

なぜFTPで管理かんりしていたのか

私わたしはほとんどの記事きじを多おおくの人々ひとびとに読よんでもらえるようにルビを付つけているのですが、ルビを付つけるためのコードである<ruby>タグを多用たようすると、WAF(Web Application Firewall)というセキュリティーのためのシステムが危あぶないコードと誤検知ごけんちして、記事きじを保存ほぞんできないことが度々たびたびありました。WAFを回避かいひする手段しゅだんとして、サーバーにあるFTP(File Transfer Protocol)というファイル置おき場ばにデブログの記事きじを置おき、WordPress側がわはFTPにあるファイルを読よみ込こむ形式けいしきで管理かんりしていました。

なぜFTP管理かんりをやめたのか

FTPにファイルを置おくと、ページの視聴回数しちょうかいすうを記録きろくするためのGoogleタグをページごとに付つけないといけません。タグの取得方法しゅとくほうほうはGoogleアナリティクスのページから行おこなうのですが、手順てじゅんがやや複雑ふくざつで、毎回まいかい記事きじを書かくたびにタグを取得しゅとくするのは大変たいへんと感かんじました。WordPressの場合ばあいは訪問者数ほうもんしゃすうを一括いっかつで管理かんりしているため、管理かんりが楽らくになります。

また、関連項目かんれんこうもくやサイト共通きょうつうのヘッダーやフッターを使つかえるようになりますので、サイト内ないの他ほかのコンテンツへの回遊かいゆうがしやすくなるメリットもあったため、WordPress管理かんりにしました。

大変たいへんだったこと

WordPressで管理かんりする場合ばあい、どうやってWAFを回避かいひするかが課題かだいでした。最初さいしょは各項目かくこうもくをメタボックス(編集画面へんしゅうがめんの入力欄にゅうりょくらん)に保存ほぞんする方法ほうほうにしましたが、それはうまくいきませんでした。その後あとに本文入力欄ほんぶんにゅうりょくらんに必要ひつような項目こうもくを保存ほぞんする方法ほうほうも試ためしましたが、それもうまくいきませんでした。最終的さいしゅうてきに、メタボックスで保存ほぞんできたらそのままメタボックスを使つかい、メタボックスで保存ほぞんできなかったらFTP上じょうにあるファイルを読よみ込こむという折衷案せっちゅうあんになりました。

「AプランがダメならBプラン」という発想はっそうです。ここまでたどり着つくのに何度なんどもクロードにコードを修正しゅうせいしてもらい、何回なんかいもコードを書かき変かえました。

WordPress版ばんのアップデートポイント

通常つうじょう、関連かんれんリンクはカスタムHTMLボックスに必要ひつようなコードを書かきこんでリンクを作つくるのですが、今回こんかいはそれを自動化じどうかする仕組しくみを作つくりました。記事きじを編集へんしゅうする画面がめんに「関連項目かんれんこうもく」という欄らんを作つくり、そこにURLを入力にゅうりょくすると、サムネイルまたはSNS画像がぞうを取得しゅとくして表示ひょうじするシステムを作つくりました。

最初さいしょは文字もじだけのリンクでしたが、サムネイルの方ほうがワクワク感かんが高たかまると思おもい、サムネイルリンクにしました。このサムネイルには少すこしぷるっと震ふるえる演出えんしゅつを加くわえました。パソコンではホバーアクションという、マウスをかざすとリンク画像がぞうなどが大おおきくなったりするアニメーション機能きのうがあるのですが、スマホではホバーアクションが使つかえないので、パソコンでもスマホでもデバイスに関係かんけいなく楽たのしめる共通きょうつうの演出えんしゅつを加くわえることにしました。

⭐使つかいやすくなってパワーアップした新しんデブログをぜひご覧らんください♪😊

ChatGPTがまとめてくれた開発かいはつの全行程ぜんこうていを詳くわしく知しりたい方かたはこちら

👉 FTP管理かんりからWordPress管理かんりへの移行記録いこうきろくを読よむ

The Devlog Has Moved from FTP to WordPress!

Why I Originally Used FTP

I add furigana (reading guides) to most of my articles so that more people can enjoy reading them. However, when I used many <ruby> tags, the security system called WAF (Web Application Firewall) sometimes mistakenly detected the code as dangerous and prevented me from saving my articles. To work around this problem, I stored my devlog articles in files on the server and had WordPress read those files via FTP (File Transfer Protocol).

Why I Stopped Using FTP

When storing files via FTP, I had to add the Google tag used to record page views to each page individually. I had to obtain the tag through Google Analytics, and the process was somewhat complicated. Getting a new tag every time I wrote an article felt like a lot of work. With WordPress, visitor data can be managed centrally, making the process much easier.

WordPress also allows me to use related-content links and the site's shared header and footer. This makes it easier for visitors to explore other content on the site, so I decided to move the devlog to WordPress.

What Made the Process Difficult

The main challenge was finding a way to work around the WAF while managing everything in WordPress. At first, I tried saving each item in a meta box (an input field in the editing screen), but that did not work well. I then tried saving the required information in the main content editor, but that did not work either. In the end, I adopted a hybrid approach: use the meta boxes whenever saving works, and read the files stored via FTP whenever saving through the meta boxes fails.

The idea was simple: “If Plan A doesn't work, try Plan B.” It took many rounds of code revisions with Claude to get to this solution.

What's Improved in the WordPress Version

Normally, I create related links by writing the required code in a Custom HTML block. This time, I built a system to automate the process. I added a “Related Items” field to the article editor. When I enter a URL there, the system retrieves and displays a thumbnail or a social media image.

The links originally consisted of text only, but I thought thumbnails would make them more exciting, so I switched to thumbnail links. I also added a subtle wobble animation to the thumbnails. On a computer, a hover effect can enlarge a linked image when you move the mouse over it. However, hover effects do not work the same way on smartphones, so I created a shared animation that can be enjoyed on both computers and smartphones.

⭐ The new and improved devlog is easier to use and more powerful. Come check it out! 😊

Want to learn more about the entire development process documented with ChatGPT? Read the detailed article here:

👉 Read the full development story: From FTP to WordPress

コメント