Hugo PaperModにBlueskyへの共有を追加する
このBlogでは、現在、Hugo PaperModをテーマとして使用しています。現在、Hugo PaperModは結構いろいろなSNSに共有する機能がありますが、 残念ながらBlueskyへの共有はついていません。しかし、対応自体は可能です。 まず、共有はthemes/hugo-PaperMod/layouts/partials/share_icons.htmlに実体があります。 この中を見ていきます。 以下のようなものが見えてきます。 {{- if (or (cond ($custom) (in $ShareButtons "x") (true)) (cond ($custom) (in $ShareButtons "twitter") (true))) }} <li> <a target="_blank" rel="noopener noreferrer" aria-label="share {{ $title | plainify }} on x" href="https://x.com/intent/tweet/?text={{ $title }}&url={{ $pageurl }}&hashtags={{- $.Scratch.Get "tags" -}}"> <svg version="1.1" viewBox="0 0 512 512" xml:space="preserve" height="30px" width="30px" fill="currentColor"> <path d="M512 62.554 L 512 449.446 C 512 483.97 483.97 512 449.446 512 L 62.554 512 C 28.03 512 0 483.97 0 449.446 L 0 62.554 C 0 28.03 28.029 0 62.554 0 L 449.446 0 C 483.971 0 512 28.03 512 62.554 Z M 269.951 190.75 L 182.567 75.216 L 56 75.216 L 207.216 272.95 L 63.9 436.783 L 125.266 436.783 L 235.9 310.383 L 332.567 436.783 L 456 436.783 L 298.367 228.367 L 432.367 75.216 L 371.033 75.216 Z M 127.633 110 L 164.101 110 L 383.481 400.065 L 349.5 400.065 Z" /> </svg> </a> </li> {{- end }} これは、Twitter(X)への共有機能ですが、この前でも後ろでもに以下のようなものを挿入します。ただし、themes以下を直に変更すると面倒なので、ベストプラクティス通り、layouts/partialsに複製して変更します。 ...