ヘッダーにSNSアイコンを表示したい

Topic summary

Tasteテーマを使用しているユーザーが、ヘッダーにSNSアイコンを表示しようとしている問題。

試した方法:

  • footer.liquidにあるコードをheader.liquidにコピー&ペーストしたが反映されず
  • 一部のコード(「if settings.brand_image」から「endif」まで)を削除して試したが、同様に反映されなかった

解決方法:

  • 正しいコードは {%- render 'social-icons' -%} を使用する
  • デフォルト機能として、デスクトップのヘッダーやフッターにSNSアイコンを表示することが可能
  • 表示・非表示の切り替えやレイアウト調整には別途コードの記述が必要

結果: 問題は無事解決した。

Summarized with AI on November 5. AI used: claude-sonnet-4-5-20250929.

Tasteのテーマを使用しています。

https://community.shopify.com/c/%E6%8A%80%E8%A1%93%E7%9A%84%E3%81%AAq-a/bd-p/tqa-jp

上記 Q&Aを参考にfooter.liquidにある以下をコピーしてheader.liquid内に貼り付けましたが反映されませんでした。

※また、「if settings.brand_image」〜「-%}」直上の「endif」までを削除して貼り付けてもみましたが同様に反映されませんでした。

そもそも貼り付けているソースが的違いなのか、その他原因および反映させる方法がわかると幸いです。

 {%- liquid
    assign has_social_icons = true
    if settings.social_facebook_link == blank and settings.social_instagram_link == blank and settings.social_youtube_link == blank and settings.social_tiktok_link == blank and settings.social_twitter_link == blank and settings.social_pinterest_link == blank and settings.social_snapchat_link == blank and settings.social_tumblr_link == blank and settings.social_vimeo_link == blank
      assign has_social_icons = false
    endif

    if settings.brand_image == blank and settings.brand_headline == blank and settings.brand_description == blank
      assign brand_empty = true
    endif

    if section.blocks.size == 1 and section.blocks[0].type == 'brand_information' and brand_empty and has_social_icons == false and section.settings.newsletter_enable == false and section.settings.enable_follow_on_shop == false
      assign only_empty_brand = true
    endif
  -%}

SNSアイコンを表示するコードは以下になります。

{%- render 'social-icons' -%}

表示・非表示の切り替えやレイアウトの調整は、別途コードを記述する必要があります。

デフォルトの機能で、告知バーにSNSアイコンを表示することができるので、そちらを使う方法もありますね(デスクトップのみですが)。

1 Like

ありがとうございます!無事に解決しました!