templates/base.html.twig line 235

  1. {% set FLUID_CONTAINER = false %}
  2. {% set isEgyptSite = get_setting('general', 'country') == 'EG' %}
  3. {% set isKSASite = get_setting('general', 'country') == 'SA' %}
  4. {% set isEnabledKSAnewHome = isKSASite and isEnabledFeature('web.ksa.newhome') %}
  5. {% set isProduction = app.environment == 'prod' %}
  6. {% set isGoogleTagManagerDisabledTest = isEnabledFeature('web.disable.tagmanager') %}
  7. <!DOCTYPE html>
  8. <html lang="{{ app.request.locale }}" dir="{{ 'layout.direction_code'|trans }}" ng-app="moonshot">
  9. {% set isSearchResultsPage = app.request.attributes.get('_route') in ['search', 'property_type_search'] %}
  10. {% set isComoundResultsPage = app.request.attributes.get('_route') in ['compound_search'] %}
  11. {% set isListingDetailsPage = app.request.attributes.get('_route') in ['listing_slug'] %}
  12. {% import '@AqarmapListing/Default/macros/seoVersion.twig' as seoMacro %}
  13. {% set isSeoVersion = seoMacro.seoVersion(app.request.requesturi) and isSearchResultsPage and not app.user %}
  14. {% set isLongTailPage = app.request.get('lt') %}
  15. {% set isUXVersion = not isSeoVersion %}
  16. {% set allowTagManagerDelay = isSeoVersion or isComoundResultsPage or isListingDetailsPage %}
  17. {% set hiddenParametersLanguageRoutes = ['search', 'property_type_search', 'listing_slug'] %}
  18. {% set removeParametersLanguageSwitcher = app.request.attributes.get('_route') in hiddenParametersLanguageRoutes and not isLongTailPage %}
  19. {% set adminBodyClass = is_granted("ROLE_ADMIN") ? 'is-admin' : '' %}
  20. {% set searchResultsBodyClass = isSearchResultsPage ? 'initial-font' : '' %}
  21. {% set aqarmap_exhibits_guide_url = aqarmap_advice_url ~ '/' ~ app.request.locale ~ '/events' %}
  22. {% set isUserHasActiveSubscription = app.user and app.user.getAbsoluteSubscriptionExpiryDays > 0 %}
  23. {% set appLocale = app.request.locale %}
  24. {% set isLocalArabic = appLocale == 'ar' %}
  25. <head>
  26. <meta charset="{{ _charset }}" />
  27. <title>{% block title %}{{ 'layout.brand_suffix'|trans }}{% endblock %}</title>
  28. {% set hiddenMetaDescriptionRoutes = ['compound_search'] %}
  29. {% if app.request.attributes.get('_route') not in hiddenMetaDescriptionRoutes or (app.request.attributes.get('_route') == 'listing_slug' and listing.section.searchable) %}
  30. <meta name="description" content="{% if block('meta_description') is defined -%}
  31. {{- block('meta_description')|default('layout.homepage_description'|trans)|striptags|u.truncate(250, true, true)|replace({"\n": " ", "\r\n": " ", "\t": " ", "\n\r": " ", " ": ".."})|replace({" ": ". "})|trim('.') -}}
  32. {%- else -%}
  33. {{- 'layout.homepage_description'|trans|striptags|u.truncate(250, true, true)|replace({"\n": " ", "\r\n": " ", "\t": " ", "\n\r": " ", " ": ".."})|replace({" ": ". "})|trim('.') -}}
  34. {%- endif %}">
  35. {% endif %}
  36. <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" >
  37. <meta http-equiv="Accept-CH" content="DPR, Width, Viewport-Width">
  38. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  39. <meta name="theme-color" content="#007dbe">
  40. <meta name="author" content="{{ 'layout.app_name'|trans }}">
  41. <meta name="apple-itunes-app" content="app-id=642633889">
  42. <meta name="google-play-app" content="app-id=com.aqarmap.android">
  43. {% if app_domain != app.request.getHost() %}<meta name="robots" content="noindex, nofollow">{% endif %}
  44. {% block metatags %}{% endblock %}
  45. <link rel="preload" as="image" href="{{ asset('images/placeholder.svg') }}">
  46. <link rel="preload" as="image" href="{{ asset('images/logo-' ~ app.request.locale ~ '-white.svg') }}">
  47. <link rel="icon" type="image/x-icon" href="{{ asset('favicon.ico') }}" />
  48. <link rel="manifest" href="{{ asset('manifest.json') }}" />
  49. {% block htmlhead %}{% endblock %}
  50. {% block categorizedStylesheets -%}
  51. {{ encore_entry_link_tags('build') }}
  52. {% endblock %}
  53. {% block favouriteHead %}
  54. {% endblock %}
  55. {% set topBar = active_announcement({topBar : true}) %}
  56. {% block headScripts %}
  57. <script>
  58. var app_data = {};
  59. app_data.locale = '{{ appLocale }}';
  60. app_data.debug = {{ (app.debug ? true : false)|serialize }};
  61. app_data.base_url = {{ url('homepage')|serialize|raw }};
  62. app_data.is_authenticated = {{ is_granted("IS_AUTHENTICATED_REMEMBERED")|serialize|raw }};
  63. app_data.messaging_api_key = "{{ firebase_api_key }}";
  64. app_data.messaging_sender_id = "{{ firebase_sender_id }}";
  65. app_data.country = "{{ get_setting('general', 'country') | lower }}";
  66. app_data.topBar = "{{ topBar is not null ? true : false }}";
  67. app_data.topBarStarts = "{{ topBar is not null ? topBar.startAt : false }}";
  68. app_data.topBarCounter = "{{ topBar is not null ? topBar.counter : false }}";
  69. app_data.environment = "{{ app.environment }}"
  70. app_data.currency = "{{ get_setting('general', 'currency')|trans }}"
  71. app_data.searchSvcUrl="{{search_service_public_endpoint}}"
  72. </script>
  73. {% endblock %}
  74. {% block env %}
  75. {% include "env.html.twig" %}
  76. {% endblock %}
  77. </head>
  78. <body class="{{ 'layout.direction_code'|trans }} {{ adminBodyClass }} {{ searchResultsBodyClass }}">
  79. {% if isProduction and not isGoogleTagManagerDisabledTest %}
  80. <!-- Google Tag Manager -->
  81. <script>
  82. var tagManagerSettings = '{{ get_setting('general', 'tag_manager') }}';
  83. var allowTagManagerDelay = '{{allowTagManagerDelay}}'
  84. </script>
  85. <noscript><iframe src="//www.googletagmanager.com/ns.html?id={{ get_setting('general', 'tag_manager') }}"
  86. height="0" width="0" style="display:none;visibility:hidden" loading="lazy"></iframe></noscript>
  87. <script type="application/javascript" src="{{ asset('builds/js/buildTagManager'~ (app.environment == 'dev' ? '' : '.min') ~'.js') }}"></script>
  88. <!-- End Google Tag Manager -->
  89. {% endif %}
  90. {% block googleDoubleclick %}
  91. {% if isProduction and isUXVersion %}
  92. <script src="https://securepubads.g.doubleclick.net/tag/js/gpt.js"></script>
  93. <script>
  94. window.googletag = window.googletag || {cmd: []};
  95. googletag.cmd.push(function() {
  96. googletag.pubads().enableSingleRequest();
  97. googletag.pubads().collapseEmptyDivs();
  98. googletag.pubads().setTargeting('lang', "{{ app.request.locale }}").setTargeting('url', "{{ app.request.pathInfo }}");
  99. });
  100. {% if get_setting('general', 'country') == 'SA' %}
  101. googletag.cmd.push(function() {
  102. googletag.defineSlot('/34628225/Frontpage-KSA', [[1140, 225], [728, 144]], 'div-gpt-ad-1611048992201-0').addService(googletag.pubads());
  103. googletag.enableServices();
  104. });
  105. {% else %}
  106. googletag.cmd.push(function() {
  107. googletag.defineSlot('/34628225/half-page', [1140, 225], 'div-gpt-ad-1588539416603-0').addService(googletag.pubads());
  108. googletag.enableServices();
  109. });
  110. {% endif %}
  111. </script>
  112. <script>
  113. window.googletag = window.googletag || {cmd: []};
  114. googletag.cmd.push(function() {
  115. googletag.pubads().enableSingleRequest();
  116. googletag.pubads().collapseEmptyDivs();
  117. googletag.pubads().setTargeting('lang', "{{ app.request.locale }}").setTargeting('url', "{{ app.request.pathInfo }}");
  118. });
  119. {% if get_setting('general', 'country') == 'SA' %}
  120. googletag.cmd.push(function() {
  121. googletag.defineSlot('/34628225/sideadksalong', [300, 600], 'div-gpt-ad-1638434718795-0').addService(googletag.pubads());
  122. googletag.enableServices();
  123. });
  124. {% else %}
  125. googletag.cmd.push(function() {
  126. googletag.defineSlot('/34628225/sideadlong', [300, 600], 'div-gpt-ad-1638434601381-0').addService(googletag.pubads());
  127. googletag.enableServices();
  128. });
  129. {% endif %}
  130. </script>
  131. <script>
  132. window.googletag = window.googletag || {cmd: []};
  133. googletag.cmd.push(function() {
  134. googletag.pubads().enableSingleRequest();
  135. googletag.pubads().collapseEmptyDivs();
  136. googletag.pubads().setTargeting('lang', "{{ app.request.locale }}").setTargeting('url', "{{ app.request.pathInfo }}");
  137. });
  138. {% if get_setting('general', 'country') == 'SA' %}
  139. googletag.cmd.push(function() {
  140. googletag.defineSlot('/34628225/feedadksa', [320, 320], 'div-gpt-ad-1611049193067-0').addService(googletag.pubads());
  141. googletag.enableServices();
  142. });
  143. {% else %}
  144. googletag.cmd.push(function() {
  145. googletag.defineSlot('/34628225/feedad', [320, 320], 'div-gpt-ad-1588541966744-0').addService(googletag.pubads());
  146. googletag.enableServices();
  147. });
  148. {% endif %}
  149. </script>
  150. {% endif %}
  151. {% endblock %}
  152. {% block searchFilters %}
  153. {% endblock %}
  154. {% block firebase %}
  155. <div id="overlay-back"></div>
  156. <div id="overlay"><div class="overlay-text">{{ 'notification_modal.info_message'|trans }} </div></div>
  157. {% endblock %}
  158. {% block vueBody %}
  159. {% include "flashes.html.twig" %}
  160. {% set vueAppName = isListingDetailsPage ? "activitiesApp" : "vueApp" %}
  161. <div id="{{vueAppName}}"
  162. data-feature-toggle="{{ featureToggle is defined ? featureToggle|json_encode : null }}"
  163. data-user="{{ app.user ? app.user.id : null }}"
  164. data-user-email="{{ app.user ? app.user.email : null }}">
  165. {% block navigation %}
  166. {% include "header.html.twig" %}
  167. {% endblock %}
  168. {% if app.request.attributes.get('_route') == 'homepage' %}
  169. {% include "hero-searchbar.html.twig" %}
  170. <section class="container-fluid">
  171. <div class="row justify-content-center">
  172. {% if isProduction %}
  173. {% if get_setting('general', 'country') == 'SA' %}
  174. <div id='div-gpt-ad-1611048992201-0' style='width: 1140px; height: 225px;'>
  175. <script type="application/javascript" v-pre defer>
  176. if (typeof googletag !== 'undefined') {
  177. googletag.cmd.push(function() { googletag.display('div-gpt-ad-1611048992201-0'); });
  178. }
  179. </script>
  180. </div>
  181. {% else %}
  182. <div id='div-gpt-ad-1588539416603-0' style='width: 1140px; height: 225px;'>
  183. <script type="application/javascript" v-pre defer>
  184. if (typeof googletag !== 'undefined') {
  185. googletag.cmd.push(function() { googletag.display('div-gpt-ad-1588539416603-0'); });
  186. }
  187. </script>
  188. </div>
  189. {% endif %}
  190. {% else %}
  191. <div class="takeover-ad" style="text-align: center; background-color: {{ get_setting('features', 'takeover_ad_color') }};">
  192. <img src="https://placehold.it/1140x225/DFDFDF/B6B6B6&text=AD%20BANNER%20(1140%20X%20225)" width="100%" alt="" />
  193. </div>
  194. {% endif %}
  195. </div>
  196. </section>
  197. {% endif %}
  198. {% block headerTop %}
  199. {% include "adsHeader.html.twig" %}
  200. {% endblock %}
  201. {% block body %}
  202. {% endblock %}
  203. {% block modals %}
  204. {% endblock %}
  205. </div>
  206. {% endblock %}
  207. {% block footer %}
  208. {% set hiddenFooterRoutes = ['listing_initialize', 'listing_edit', 'listing_upload', 'listing_confirm_publish_credit'] %}
  209. {% if app.request.attributes.get('_route') not in hiddenFooterRoutes %}
  210. {% include "footer.v2.html.twig" %}
  211. {% endif %}
  212. {% endblock %}
  213. {% block stylesheets -%}
  214. {% if ('layout.direction_code'|trans) == 'rtl' -%}
  215. <link href="{{ asset('builds/css/bootstrap-rtl.min.css') }}" rel="stylesheet" media="print" onload="this.media='all';this.onload=null;" />
  216. {% endif -%}
  217. {% endblock %}
  218. {% block getTranslations %}
  219. {% include "get-translations.html.twig" %}
  220. {% endblock %}
  221. <!-- Javascript categorized files -->
  222. {% block categorizedJavascripts %}
  223. <script src="{{ asset('builds/js/build'~ (app.environment == 'dev' ? '' : '.min') ~'.js') }}"></script>
  224. <script defer type="application/javascript" src="{{ asset('builds/js/buildTopSellers'~ (app.environment == 'dev' ? '' : '.min') ~'.js') }}"></script>
  225. {% if topBar is not null %}
  226. {{ encore_entry_script_tags('countdown') }}
  227. {% endif %}
  228. {% endblock %}
  229. <!-- Javascript files -->
  230. {% block javascripts %}
  231. <script src="{{ asset('js/translations/jstranslation/'~ app.request.locale ~'.js') }}" defer></script>
  232. <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
  233. <!--[if lt IE 9]>
  234. <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
  235. <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
  236. <![endif]-->
  237. <script type="application/javascript">
  238. // Google Tag Manager Data Layer initialization
  239. window.dataLayer = window.dataLayer || [];
  240. // Translator initialization
  241. window.Translator = window.Translator || [];
  242. </script>
  243. {# Criteo Custom DataLayer #}
  244. {% set criteo_custom_datalayer = {'PageType': 'TransactionPage', 'email': ' '} %}
  245. {# Criteo DataLayer #}
  246. {% set criteo_datalayer = {'PageType': app.request.attributes.get('_route')} %}
  247. {% if app.request.attributes.get('_route') == 'search' or app.request.attributes.get('_route') == 'property_type_search' -%}
  248. {% set criteo_datalayer = {'PageType': 'search'} %}
  249. {% endif %}
  250. {% set criteo_datalayer = criteo_datalayer|merge({'email': ' '}) %}
  251. {% if app.request.attributes.get('_route') == 'listing_slug' %}
  252. {% set criteo_datalayer = {'PageType': 'ListingPage', 'email': ' '} %}
  253. {% set criteo_custom_datalayer = criteo_custom_datalayer|merge({'ProductTransactionProducts': [{ 'id': listing.id , 'price': '0.01' , 'quantity': '1' }]}) %}
  254. {% set criteo_datalayer = criteo_datalayer|merge({'ListingID': listing.id}) %}
  255. <script>
  256. $(document).ready(function () {
  257. dataLayer.push({{ criteo_custom_datalayer|json_encode|raw }});
  258. });
  259. </script>
  260. {% if listing.liveChildren is not empty %}
  261. {% set criteo_datalayer = criteo_datalayer|merge({'unitsIDs': listing.liveChildrenIDs}) %}
  262. {% endif -%}
  263. {% endif %}
  264. {% if app.request.attributes.get('_route') == 'search' or app.request.attributes.get('_route') == 'property_type_search' -%}
  265. {% set criteo_datalayer = criteo_datalayer|merge({'ListingIDList': resultsIDs|slice(1, 3)}) %}
  266. {% endif %}
  267. <script>
  268. $(document).ready(function () {
  269. dataLayer.push({{ criteo_datalayer|json_encode|raw }});
  270. });
  271. </script>
  272. {% endblock %}
  273. {% block fos %}
  274. {% if app.debug %}
  275. <script src="{{ path('fos_js_routing_js', {"callback": "fos.Router.setData"}) }}"></script>
  276. {% else %}
  277. <script src="{{ asset('js/fos_js_routes.js') }}"></script>
  278. <script>
  279. Routing.setPrefix("{{ app.request.locale }}__RG__");
  280. </script>
  281. {% endif %}
  282. {% endblock %}
  283. {% block extraScripts %}
  284. {% if app.request.attributes.get('_route') == 'homepage' %}
  285. <script type="application/javascript" src="{{ asset('js/priceFilters.js') }}"></script>
  286. {% endif %}
  287. {% endblock extraScripts %}
  288. {% block wootricScript %}
  289. {% if isUXVersion %}
  290. <!-- begin Wootric code -->
  291. <script>
  292. window.wootric = function(){};
  293. </script>
  294. <script type="text/javascript" src="https://cdn.wootric.com/wootric-sdk.js"></script>
  295. <script id="wootricScript" src="{{ asset('builds/js/buildWootric'~ (app.environment == 'dev' ? '' : '.min') ~'.js') }}"></script>
  296. {% else %}
  297. <script>
  298. $(document).ready(function () {
  299. {% if app.user %}
  300. dataLayer.push({
  301. 'userEmail': '{{ app.user.email }}',
  302. 'userCreatedAt': '{{ app.user.createdAt|date('U') }}',
  303. });
  304. {% endif %}
  305. });
  306. </script>
  307. {% endif %}
  308. {% endblock %}
  309. {% block facebookLogin %}
  310. {% endblock %}
  311. {% block googleLogin %}
  312. {% include "googleLogin.html.twig" %}
  313. {% endblock googleLogin %}
  314. </body>
  315. </html>