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

**URL:** <https://community.shopify.com/t/sns/361371>\
**Category:** 技術的なQ＆A\
**Created:** [September 25, 2024, 2:29pm UTC](https://community.shopify.com/t/sns/361371 "2024-09-25T14:29:53Z")\
**Posts on this page:** 3\
**Page:** 1

## AI-generated summary

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

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

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

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

<div class="post-metadata">

**Author:** ![Takahisa](https://avatars.discourse-cdn.com/v4/letter/t/dfb087/32.png) [@Takahisa](https://community.shopify.com/u/Takahisa)\
**Post date:** [September 25, 2024, 2:29pm UTC](https://community.shopify.com/t/sns/361371/1 "2024-09-25T14:29:53Z")

</div>

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

[https://community.shopify.com/category/tqa-jp](https://community.shopify.com/category/tqa-jp)

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

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

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

```auto
 {%- 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
  -%}

```

---

<div class="post-metadata">

**Author:** ![Anonymous\_5168086324d6fa4637c896de39bb248c](https://yyz1.discourse-cdn.com/shopifyforum/user_avatar/community.shopify.com/anonymous_5168086324d6fa4637c896de39bb248c/32/28647_2.png) [@Anonymous\_5168086324d6fa4637c896de39bb248c](https://community.shopify.com/u/Anonymous_5168086324d6fa4637c896de39bb248c)\
**Post date:** [September 25, 2024, 11:19pm UTC](https://community.shopify.com/t/sns/361371/2 "2024-09-25T23:19:06Z")

</div>

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

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

```

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

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

---

<div class="post-metadata">

**Author:** ![Takahisa](https://avatars.discourse-cdn.com/v4/letter/t/dfb087/32.png) [@Takahisa](https://community.shopify.com/u/Takahisa)\
**Post date:** [September 26, 2024, 1:44pm UTC](https://community.shopify.com/t/sns/361371/3 "2024-09-26T13:44:29Z")

</div>

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