src/Eccube/Resource/template/default/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.     <meta property="og:title" content="{{ BaseInfo.shop_name ~ ' / ' ~ Product.papc3 ~ Product.name ~ Product.papc4 }}" />
  6.     {% if Product.papc12 and Product.papc12 != '' %}
  7.     <meta property="og:image" content="{{ url('homepage') ~ Product.papc12 }}" />
  8.     {% else %}
  9.     <meta property="og:image" content="{{ absolute_url(asset(Product.main_list_image|no_image_product, 'save_image')) }}" />
  10.     {% endif %}
  11.     <meta property="product:price:amount" content="{{ Product.getPrice02IncTaxMin }}"/>
  12.     <meta property="product:price:currency" content="{{ eccube_config.currency }}"/>
  13.     <meta property="product:product_link" content="{{ url('product_detail', {'id': Product.id}) }}"/>
  14.     <meta property="product:retailer_title" content="{{ BaseInfo.shop_name }}"/>
  15.     {% if not Product.stock_find %}
  16.         <meta name="robots" content="noindex">
  17.     {% endif %}
  18. {% elseif app.request.get('_route') == 'product_list' %}
  19.     {% set meta_canonical = url('product_list', {'category_id': Category.id|default(null)}) %}
  20.     {% if pagination|length == 0 %}
  21.         <meta name="robots" content="noindex">
  22.     {% endif %}
  23. {% elseif app.request.get('_route') == 'homepage' %}
  24.     {% set meta_og_type = 'website' %}
  25.     {% set meta_canonical = url('homepage') %}
  26. {% elseif Page is defined and Page.edit_type == 0 and Page.url is defined %}
  27.     {% set meta_canonical = url(eccube_config.eccube_user_data_route, {'route': Page.url}) %}
  28. {% endif %}
  29. <meta property="og:type" content="{{ meta_og_type|default('article') }}"/>
  30. <meta property="og:site_name" content="{{ BaseInfo.shop_name }}"/>
  31. {% set meta_description = meta_description | default(Page.description) %}
  32. {% if meta_description %}
  33.     {# <meta name="description" content="{{ meta_description|striptags|slice(0,120) }}"> #}
  34.     {# <meta property="og:description" content="{{ meta_description|striptags|slice(0,120) }}"/> #}
  35. {% endif %}
  36. {% if meta_canonical|default() %}
  37.     {# canonical url #}
  38.     {# Product list #}
  39.     {% if Category is defined and Category %}
  40.         {% if pagination is defined and pagination.paginationData is defined and pagination.paginationData.pageCount > 1 %}
  41.             {# 最初のページ #}
  42.             {% if pagination.paginationData.current == 1  %}
  43.             <meta property="og:url" content="{{ meta_canonical }}"/>
  44.             <link rel="next" href="{{ meta_canonical }}&pageno=2" title="{{ Category.name }} {{ '%pageno%ページ目'|trans({ '%pageno%': 2 }) }}">
  45.             <link rel="canonical" href="{{ meta_canonical }}" />
  46.             {# 最後のページ #}
  47.             {% elseif pagination.paginationData.last == pagination.paginationData.current %}
  48.             <meta property="og:url" content="{{ meta_canonical }}&pageno={{ pagination.paginationData.last }}"/>
  49.             <link rel="prev" href="{{ meta_canonical }}&pageno={{ pagination.paginationData.previous }}" title="{{ Category.name }} {{ '%pageno%ページ目'|trans({ '%pageno%': pagination.paginationData.previous }) }}">
  50.             <link rel="canonical" href="{{ meta_canonical }}&pageno={{ pagination.paginationData.last }}" />
  51.             {# 途中のページ #}
  52.             {% else %}
  53.             <meta property="og:url" content="{{ meta_canonical }}&pageno={{ pagination.paginationData.current }}"/>
  54.             <link rel="next" href="{{ meta_canonical }}&pageno={{ pagination.paginationData.next }}" title="{{ Category.name }} {{ '%pageno%ページ目'|trans({ '%pageno%': pagination.paginationData.next }) }}">
  55.             <link rel="prev" href="{{ meta_canonical }}&pageno={{ pagination.paginationData.previous }}" title="{{ Category.name }} {{ '%pageno%ページ目'|trans({ '%pageno%': pagination.paginationData.previous }) }}">
  56.             <link rel="canonical" href="{{ meta_canonical }}&pageno={{ pagination.paginationData.current }}" />
  57.             {% endif %}
  58.         {% else %}
  59.         {# ページング無し #}
  60.         <meta property="og:url" content="{{ meta_canonical }}"/>
  61.         <link rel="canonical" href="{{ meta_canonical }}" />
  62.         {% endif %}
  63.     {# Other #}
  64.     {% else %}
  65.     <meta property="og:url" content="{{ meta_canonical }}"/>
  66.     <link rel="canonical" href="{{ meta_canonical }}" />
  67.     {% endif %}
  68. {% endif %}