app/template/BlackCherry/meta.twig line 1

Open in your IDE?
  1. {% if app.request.get('_route') == 'product_detail' %}
  2.     {% set meta_og_type = "og:product" %}
  3.     {% set meta_description = Product.description_list | default(Product.description_detail) | default(Page.description) %}
  4.     {% set meta_canonical = url('product_detail', {'id': Product.id}) %}
  5.     
  6.     {# robotsメタタグの設定(優先順位順) #}
  7.     {% set robots_content = null %}
  8.     
  9.     {# 1. メーカーのnoindexフラグをチェック #}
  10.     {% if Product.Maker is defined and Product.Maker and Product.Maker.noindexFlg %}
  11.         {% set robots_content = 'noindex, nofollow' %}
  12.     {# 2. 在庫なしの場合 #}
  13.     {% elseif not Product.stock_find %}
  14.         {% set robots_content = 'noindex' %}
  15.     {% endif %}
  16.     
  17.     {# robotsメタタグを出力(1つだけ) #}
  18.     {% if robots_content %}
  19.         <meta name="robots" content="{{ robots_content }}">
  20.     {% endif %}
  21.     
  22.     <meta property="og:title" content="{{ Product.name }}" />
  23.     <meta property="og:image" content="{{ absolute_url(asset(Product.main_list_image|no_image_product, 'save_image')) }}" />
  24.     <meta property="product:price:amount" content="{{ Product.getPrice02IncTaxMin }}"/>
  25.     <meta property="product:price:currency" content="{{ eccube_config.currency }}"/>
  26.     <meta property="product:product_link" content="{{ url('product_detail', {'id': Product.id}) }}"/>
  27.     <meta property="product:retailer_title" content="{{ BaseInfo.shop_name }}"/>
  28. {% elseif app.request.get('_route') == 'product_list' %}
  29.     {% set meta_canonical = url('product_list', {'category_id': Category.id|default(null)}) %}
  30.     {% if pagination|length == 0 %}
  31.         <meta name="robots" content="noindex">
  32.     {% endif %}
  33. {% elseif app.request.get('_route') == 'homepage' %}
  34.     {% set meta_og_type = 'website' %}
  35.     {% set meta_canonical = url('homepage') %}
  36. {% elseif Page is defined and Page.edit_type == 0 and Page.url is defined and Page.url is not empty %}
  37.     {% set meta_canonical = url(eccube_config.eccube_user_data_route, {'route': Page.url}) %}
  38. {% endif %}
  39. <meta property="og:type" content="{{ meta_og_type|default('article') }}"/>
  40. <meta property="og:site_name" content="{{ BaseInfo.shop_name }}"/>
  41. {% set meta_description = meta_description | default(Page.description) %}
  42. {% if meta_description %}
  43.     <meta name="description" content="{{ meta_description|striptags|slice(0,120) }}">
  44.     <meta property="og:description" content="{{ meta_description|striptags|slice(0,120) }}"/>
  45. {% endif %}
  46. {% if meta_canonical|default() %}
  47.     {# canonical url #}
  48.     {# Product list #}
  49.     {% if Category is defined and Category %}
  50.         {% if pagination is defined and pagination.paginationData is defined and pagination.paginationData.pageCount > 1 %}
  51.             {# 最初のページ #}
  52.             {% if pagination.paginationData.current == 1  %}
  53.             <meta property="og:url" content="{{ meta_canonical }}"/>
  54.             <link rel="next" href="{{ meta_canonical }}&pageno=2" title="{{ Category.name }} {{ '%pageno%ページ目'|trans({ '%pageno%': 2 }) }}">
  55.             <link rel="canonical" href="{{ meta_canonical }}" />
  56.             {# 最後のページ #}
  57.             {% elseif pagination.paginationData.last == pagination.paginationData.current %}
  58.             <meta property="og:url" content="{{ meta_canonical }}&pageno={{ pagination.paginationData.last }}"/>
  59.             <link rel="prev" href="{{ meta_canonical }}&pageno={{ pagination.paginationData.previous }}" title="{{ Category.name }} {{ '%pageno%ページ目'|trans({ '%pageno%': pagination.paginationData.previous }) }}">
  60.             <link rel="canonical" href="{{ meta_canonical }}&pageno={{ pagination.paginationData.last }}" />
  61.             {# 途中のページ #}
  62.             {% else %}
  63.             <meta property="og:url" content="{{ meta_canonical }}&pageno={{ pagination.paginationData.current }}"/>
  64.             <link rel="next" href="{{ meta_canonical }}&pageno={{ pagination.paginationData.next }}" title="{{ Category.name }} {{ '%pageno%ページ目'|trans({ '%pageno%': pagination.paginationData.next }) }}">
  65.             <link rel="prev" href="{{ meta_canonical }}&pageno={{ pagination.paginationData.previous }}" title="{{ Category.name }} {{ '%pageno%ページ目'|trans({ '%pageno%': pagination.paginationData.previous }) }}">
  66.             <link rel="canonical" href="{{ meta_canonical }}&pageno={{ pagination.paginationData.current }}" />
  67.             {% endif %}
  68.         {% else %}
  69.         {# ページング無し #}
  70.         <meta property="og:url" content="{{ meta_canonical }}"/>
  71.         <link rel="canonical" href="{{ meta_canonical }}" />
  72.         {% endif %}
  73.     {# Other #}
  74.     {% else %}
  75.     <meta property="og:url" content="{{ meta_canonical }}"/>
  76.     <link rel="canonical" href="{{ meta_canonical }}" />
  77.     {% endif %}
  78. {% endif %}