{% set cache = pimcore_cache(metaCacheKey) %}
{% if not isFrontendRequestByAdmin and not cache.start() %}
	{% if document is instanceof('\\Pimcore\\Model\\Document\\Page') %}
		{% do pimcore_head_title().setSeparator(document.getProperty('titleSeparator')) %}
		{% if not pimcore_head_title().container.getValue() and document.getTitle() is not empty %}
			{% do pimcore_head_title().set(document.getTitle()) %}
		{% endif %}
		{% do pimcore_head_title().append(document.getProperty('titlePostfix')) %}
		{% do pimcore_head_meta().setName('viewport', 'width=device-width,initial-scale=1') %}
		{% do pimcore_head_meta().setHttpEquiv('Content-Type', 'text/html; charset=utf-8') %}
		{% do pimcore_head_meta().setHttpEquiv('x-ua-compatible', 'ie=edge') %}
		{% do pimcore_head_meta().setName('author', 'portadesign.cz') %}
		{% set metaDescription = pimcore_head_meta().getItem('name', 'description') %}
		{% if metaDescription is empty %}
			{% do pimcore_head_meta().setName('description', document.getDescription()) %}
		{% endif %}
	{% endif %}

	{# Open Graph #}
	{% if dataObject is defined and dataObject and dataObject is instanceof('\\Pimcore\\Model\\DataObject') %}
		{% set ogTags =  get_data_object_og_meta_tags(dataObject, language) %}
	{% elseif document is instanceof('\\Pimcore\\Model\\Document\\Page') %}
		{% set ogTags =  get_page_og_meta_tags(document, language) %}
	{% endif %}
	{% if ogTags is defined and ogTags is not empty %}
		{% for property, content in ogTags %}
			{% do pimcore_head_meta().setProperty(property, content) %}
		{% endfor %}
	{% endif %}

	{{ pimcore_head_title() }}
	{{ pimcore_head_meta() }}

	{% do cache.end() %}
{% endif  %}
