app/template/default/Block/meta.twig line 1

Open in your IDE?
  1. {% set OGType = "article" %}
  2.     {% if subtitle is defined and subtitle is not empty %}
  3.         {% set titleTag = subtitle %}
  4.     {% elseif title is defined and title is not empty  %}
  5.         {% set titleTag = title %}
  6.     {% endif %}
  7.     {% if titleTag == "TOPページ" %}
  8.         {% set titleTag = "" %}
  9.         {% set OGType = "website" %}
  10.     {% endif %}
  11.     {% if titleTag %}
  12.         {% set titleTag = titleTag~" | " %}
  13.     {% endif %}
  14.     <title>{{ titleTag }}{{ BaseInfo.shop_name }}</title>
  15.     {% if Page.author is not empty %}
  16.         <meta name="author" content="{{ Page.author }}">
  17.     {% endif %}
  18.     {# 下記の中身だけはその店舗のdescriptionに変えてください #}
  19.     {% set descriptionTag = "{{ BaseInfo.shop_name }}では履きやすくおしゃれな靴を販売しています。" %}
  20.     {% if Page.description is not empty %}
  21.         {% set descriptionTag = Page.description %}
  22.     {% endif %}
  23.     {% if Product.description_detail is defined and Product.description_detail is not empty %}
  24.         {% set descriptionTag = Product.description_detail|replace({"\n":"", "\r":""}) %}
  25.     {% endif %}
  26.     {% if Category.name is defined and Category.name is not empty %}
  27.         {% set descriptionTag = Category.name~"カテゴリの商品一覧です。"~BaseInfo.shop_name~" オンラインショップ" %}
  28.     {% endif %}
  29.     {% if titleTag == "全商品 | " %}
  30.         {% set descriptionTag = BaseInfo.shop_name~" オンラインショップの商品一覧です。" %}
  31.     {% endif %}
  32.     {% if descriptionTag %}
  33.         {% set descriptionTag = descriptionTag|length > 120 ? descriptionTag|slice(0, 120) ~ '…' : descriptionTag %}
  34.     {% spaceless %}
  35.         <meta name="description" content="{{ descriptionTag }}">
  36.     {% endspaceless %}
  37.     {% endif %}
  38.     {% if Page.keyword is not empty %}
  39.         <meta name="keywords" content="{{ Page.keyword }}">
  40.     {% endif %}
  41.     {% if Page.meta_robots is not empty %}
  42.         <meta name="robots" content="{{ Page.meta_robots }}">
  43.     {% endif %}
  44.     <meta property="og:title" content="{{ titleTag }}{{ BaseInfo.shop_name }}">
  45.     <meta property="og:type" content="{{ OGType }}">
  46.     <meta property="og:url" content="{{ app.request.uri }}">
  47.     <meta property="og:description" content="{{ descriptionTag }}">
  48.     {% set OGImage = url('homepage')~"html/user_data/assets/img/common/og_image.jpg" %}
  49.     {# カテゴリイメージがある場合は下記をアンコメント #}
  50.     {# {% if category_id is defined and category_id is not empty %}
  51.         {% set OGImage = url('homepage')~asset("assets/img/category/img_cate_pc-"~category_id~".jpg", 'user_data') %}
  52.     {% endif %} #}
  53.     {% if Product is defined and Product is not empty %}
  54.         {% set OGImage = url('homepage')~asset(Product.main_list_image|no_image_product, 'save_image') %}
  55.     {% endif %}
  56.     <meta property="og:image" content="{{ OGImage }}">
  57.     {% if Page.meta_tags is not empty %}
  58.         {{ include(template_from_string(Page.meta_tags)) }}
  59.     {% endif %}