更新:
Feedlyのfaviconをカスタマイズする方法
この記事では、Feedlyのフィード選択画面に表示されるfaviconをカスタマイズする方法をまとめます。
Feedlyのサムネイルをカスタマイズする方法は、こちらの記事で解説しています。

Feedlyのサムネイルをカスタマイズする方法
この記事では、Feedlyのフィード画面に表示されるサムネイルをカスタマイズする方法をまとめます。
Feedlyのデフォルトのfavicon
Feedlyのデフォルトのfaviconは、Googleの非公式APIから取得されているようです。次のURLにアクセスすると、任意のドメインのfaviconを取得できます。
try{(()=>{function a(e){if(!e)return;let t=e.getAttribute("tabindex")!==null,n=e.scrollWidth>e.clientWidth;n&&!t?e.setAttribute("tabindex","0"):!n&&t&&e.removeAttribute("tabindex")}var u=window.requestIdleCallback||(e=>setTimeout(e,1)),i=window.cancelIdleCallback||clearTimeout;function l(e){let t=new Set,n,r;return new ResizeObserver(c=>{c.forEach(o=>t.add(o.target)),n&&clearTimeout(n),r&&i(r),n=setTimeout(()=>{r&&i(r),r=u(()=>{t.forEach(o=>e(o)),t.clear()})},250)})}function d(e,t){e.querySelectorAll?.(".expressive-code pre > code").forEach(n=>{let r=n.parentElement;r&&t.observe(r)})}var s=l(a);d(document,s);var b=new MutationObserver(e=>e.forEach(t=>t.addedNodes.forEach(n=>{d(n,s)})));b.observe(document.body,{childList:!0,subtree:!0});document.addEventListener("astro:page-load",()=>{d(document,s)});})();}catch(e){console.error("[EC] tabindex-js-module failed:",e)}try{(()=>{function i(o){let e=document.createElement("pre");Object.assign(e.style,{opacity:"0",pointerEvents:"none",position:"absolute",overflow:"hidden",left:"0",top:"0",width:"20px",height:"20px",webkitUserSelect:"auto",userSelect:"all"}),e.ariaHidden="true",e.textContent=o,document.body.appendChild(e);let a=document.createRange();a.selectNode(e);let n=getSelection();if(!n)return!1;n.removeAllRanges(),n.addRange(a);let r=!1;try{r=document.execCommand("copy")}finally{n.removeAllRanges(),document.body.removeChild(e)}return r}async function l(o){let e=o.currentTarget,a=e.dataset,n=!1,r=a.code.replace(/\u007f/g,`
`);try{await navigator.clipboard.writeText(r),n=!0}catch{n=i(r)}if(!n||e.parentNode?.querySelector(".feedback"))return;let t=document.createElement("div");t.classList.add("feedback"),t.append(a.copied),e.before(t),t.offsetWidth,requestAnimationFrame(()=>t?.classList.add("show"));let c=()=>!t||t.classList.remove("show"),d=()=>{!t||parseFloat(getComputedStyle(t).opacity)>0||(t.remove(),t=void 0)};setTimeout(c,1500),setTimeout(d,2500),e.addEventListener("blur",c),t.addEventListener("transitioncancel",d),t.addEventListener("transitionend",d)}function s(o){o.querySelectorAll?.(".expressive-code .copy button").forEach(e=>e.addEventListener("click",l))}s(document);var u=new MutationObserver(o=>o.forEach(e=>e.addedNodes.forEach(a=>{s(a)})));u.observe(document.body,{childList:!0,subtree:!0});document.addEventListener("astro:page-load",()=>{s(document)});})();}catch(e){console.error("[EC] copy-js-module failed:",e)}http://www.google.com/s2/favicons?domain=<ドメイン名>
たとえば、example.com
のfaviconを取得するには、次のURLにアクセスします。
http://www.google.com/s2/favicons?domain=example.com
faviconをカスタマイズする方法
GoogleのAPIから取得したfaviconはfaviconは解像度が低く、またデータが古いことがあります。そのため、Feedlyのフィード選択画面で使用されるfaviconをカスタマイズしたい場合があります。
(window.powerTag.Init = window.powerTag.Init || []).push(function () {
window.powerAPITag.display("pw_41759");
}); 次の画像は、Feedlyでこのブログを検索した場合や、フィード選択画面を開いたときに表示されるfaviconです。

FeedlyのfaviconのカスタマイズではSVG画像を利用できるので、画面解像度に依存しない高品質のfaviconを提供できます。
Feedlyでfaviconをカスタマイズするには、次のような形式でRSSフィードを作成します。コード中の[]
で囲まれた部分は、[]を削除したうえで実際の値に置き換えてください。
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:webfeeds="http://webfeeds.org/rss/1.0" version="2.0">
<title>[フィードのタイトル]</title>
<atom:link href="[フィードのRSSファイルのURL]" rel="self" type="application/rss+xml"/>
<link>[トップページのURL]</link>
<description>[フィードの概要]</description>
<webfeeds:icon>[faviconのURL]</webfeeds:icon>
このRSSフィードをFeedlyに登録すると、webfeeds:icon
で指定したfaviconがフィード選択画面に表示されます。
Astroでの実装方法
このブログでは、静的サイトジェネレーターの
Astro
を使用しています。Astroの
@astrojs/rss
パッケージを使用したRSSフィードでfaviconをカスタマイズするには、次のようにします。
import rss from "@astrojs/rss";
export const GET = async () => {
const posts = await getCollection('article');
description: "RSSフィードの概要",
site: import.meta.env.SITE,
customData: "<webfeeds:icon>[faviconのURL]</webfeeds:icon>",
webfeeds: "http://webfeeds.org/rss/1.0"
まとめ
この記事では、Feedlyのフィード選択画面に表示されるfaviconをカスタマイズする方法をまとめました。
Feedlyのfaviconを適切にカスタマイズして、ユーザーにとって使いやすく美しいRSSフィードを提供しましょう。
参考
おすすめアイテム
※このリンクを経由して商品を購入すると、当サイトの運営者が報酬を得ることがあります。詳細はこちら。
-1.png&w=256&q=75)
生まれた時から、母国語よりも先にJavaScriptを使っていました。ネットの海のどこにもいなくてどこにでもいます。
Webフロントエンドプログラマーで、テクノロジーに関する話題を追いかけています。動画編集やプログラミングが趣味で、たまにデザインなどもやっています。主にTypeScriptを使用したWebフロントエンド開発を専門とし、便利で実用的なブラウザー拡張機能を作成しています。また、個人ブログを通じて、IT関連のニュースやハウツー、技術的なプログラミング情報を発信しています。