{% if app.request.get('_route') == 'product_detail' %}
{% set meta_og_type = "og:product" %}
{% set meta_description = Product.description_list | default(Product.description_detail) | default(Page.description) %}
{% set meta_canonical = url('product_detail', {'id': Product.id}) %}
<meta property="og:title" content="{{ Product.name }}" />
<meta property="og:image" content="{{ absolute_url(asset(Product.main_list_image|no_image_product, 'save_image')) }}" />
<meta property="product:price:amount" content="{{ Product.getPrice02IncTaxMin }}"/>
<meta property="product:price:currency" content="{{ eccube_config.currency }}"/>
<meta property="product:product_link" content="{{ url('product_detail', {'id': Product.id}) }}"/>
<meta property="product:retailer_title" content="{{ BaseInfo.shop_name }}"/>
{% if not Product.stock_find %}
<meta name="robots" content="noindex">
{% endif %}
{% elseif app.request.get('_route') == 'product_list' %}
{% set meta_canonical = url('product_list', {'category_id': Category.id|default(null)}) %}
{% if pagination|length == 0 %}
<meta name="robots" content="noindex">
{% endif %}
{% elseif app.request.get('_route') == 'homepage' %}
{% set meta_og_type = 'website' %}
{% set meta_canonical = url('homepage') %}
{% elseif Page is defined and Page.edit_type == 0 and Page.url is defined %}
{% set meta_canonical = url(eccube_config.eccube_user_data_route, {'route': Page.url}) %}
{% endif %}
<meta property="og:type" content="{{ meta_og_type|default('article') }}"/>
<meta property="og:site_name" content="{{ BaseInfo.shop_name }}"/>
{% set meta_description = meta_description | default(Page.description) %}
{% if meta_description %}
<meta name="description" content="{{ meta_description|striptags|slice(0,120) }}">
<meta property="og:description" content="{{ meta_description|striptags|slice(0,120) }}"/>
{% endif %}
{% if meta_canonical|default() %}
{# canonical url #}
{# Product list #}
{% if Category is defined and Category %}
{% if pagination is defined and pagination.paginationData is defined and pagination.paginationData.pageCount > 1 %}
{# 最初のページ #}
{% if pagination.paginationData.current == 1 %}
<meta property="og:url" content="{{ meta_canonical }}"/>
<link rel="next" href="{{ meta_canonical }}&pageno=2" title="{{ Category.name }} {{ '%pageno%ページ目'|trans({ '%pageno%': 2 }) }}">
<link rel="canonical" href="{{ meta_canonical }}" />
{# 最後のページ #}
{% elseif pagination.paginationData.last == pagination.paginationData.current %}
<meta property="og:url" content="{{ meta_canonical }}&pageno={{ pagination.paginationData.last }}"/>
<link rel="prev" href="{{ meta_canonical }}&pageno={{ pagination.paginationData.previous }}" title="{{ Category.name }} {{ '%pageno%ページ目'|trans({ '%pageno%': pagination.paginationData.previous }) }}">
<link rel="canonical" href="{{ meta_canonical }}&pageno={{ pagination.paginationData.last }}" />
{# 途中のページ #}
{% else %}
<meta property="og:url" content="{{ meta_canonical }}&pageno={{ pagination.paginationData.current }}"/>
<link rel="next" href="{{ meta_canonical }}&pageno={{ pagination.paginationData.next }}" title="{{ Category.name }} {{ '%pageno%ページ目'|trans({ '%pageno%': pagination.paginationData.next }) }}">
<link rel="prev" href="{{ meta_canonical }}&pageno={{ pagination.paginationData.previous }}" title="{{ Category.name }} {{ '%pageno%ページ目'|trans({ '%pageno%': pagination.paginationData.previous }) }}">
<link rel="canonical" href="{{ meta_canonical }}&pageno={{ pagination.paginationData.current }}" />
{% endif %}
{% else %}
{# ページング無し #}
<meta property="og:url" content="{{ meta_canonical }}"/>
<link rel="canonical" href="{{ meta_canonical }}" />
{% endif %}
{# Other #}
{% else %}
<meta property="og:url" content="{{ meta_canonical }}"/>
<link rel="canonical" href="{{ meta_canonical }}" />
{% endif %}
{% endif %}