カスタムドメイン設定を追加する

Imgur

Imgur

blog.ganyariya.dev というドメインで astro-notion-blog を Cloudflare 上にデプロイしていました。 しかし、 Google で検索すると ganyariya-blog.pages.dev でサイトが表示されてしまっています。 想定としては blog.ganyariya.dev で Google クローラに検索してもらう予定でした。

Imgur

サイトの html を確認してみると ganyariya-blog.pages.dev が OGP や link として設定されており、想定と異なっていました。

原因と解決策

url: https://github.com/otoyo/astro-notion-blog/wiki/%E3%82%AB%E3%82%B9%E3%82%BF%E3%83%A0%E3%83%89%E3%83%A1%E3%82%A4%E3%83%B3%E3%81%AE%E8%A8%AD%E5%AE%9A%E6%96%B9%E6%B3%95
title: "カスタムドメインの設定方法"
description: "🚀 Begin building your very own Notion Blog with Astro. - otoyo/astro-notion-blog"
host: github.com
favicon: https://github.githubassets.com/favicons/favicon.svg
image: https://repository-images.githubusercontent.com/586710695/8567de91-d9a8-4d77-b2d6-7ee7374116e8

CUSTOM_DOMAIN でドメイン名を設定でき、これを行い忘れていました。 Cloudflare Worker & Pages に対して設定します。

Imgur

設定後

Imgur

blog.ganyariya.dev になっていることが確認できました。

Google Analytics を設定する

url: https://github.com/otoyo/astro-notion-blog/wiki/Google-Analytics-4-%E3%81%AE%E8%A8%AD%E5%AE%9A%E6%96%B9%E6%B3%95
title: "Google Analytics 4 の設定方法"
description: "🚀 Begin building your very own Notion Blog with Astro. - otoyo/astro-notion-blog"
host: github.com
favicon: https://github.githubassets.com/favicons/favicon.svg
image: https://repository-images.githubusercontent.com/586710695/8567de91-d9a8-4d77-b2d6-7ee7374116e8

Google Analytics の設定を追加します。 PUBLIC_GA_TRACKING_ID という環境変数で Google Analytics の G-XXXXXXXXXX を設定します。