templates/base.html.twig line 231

  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. <meta name="robots" content="noindex, follow">
  44. {% if app_domain != app.request.getHost() %}<meta name="robots" content="noindex, nofollow">{% endif %}
  45. {% block metatags %}{% endblock %}
  46. <link rel="preload" as="image" href="{{ asset('images/placeholder.svg') }}">
  47. <link rel="preload" as="image" href="{{ asset('images/logo-' ~ app.request.locale ~ '-white.svg') }}">
  48. <link rel="icon" type="image/x-icon" href="{{ asset('favicon.ico') }}" />
  49. <link rel="manifest" href="{{ asset('manifest.json') }}" />
  50. {% block htmlhead %}{% endblock %}
  51. {% block categorizedStylesheets -%}
  52. <link rel="stylesheet" href="{{ asset('builds/css/build'~ (app.environment == 'dev' ? '' : '.min') ~'.css') }}" />
  53. {% endblock %}
  54. {% block favouriteHead %}
  55. {% endblock %}
  56. {% set topBar = active_announcement({topBar : true}) %}
  57. {% block headScripts %}
  58. <script>
  59. var app_data = {};
  60. app_data.locale = '{{ appLocale }}';
  61. app_data.debug = {{ (app.debug ? true : false)|serialize }};
  62. app_data.base_url = {{ url('homepage')|serialize|raw }};
  63. app_data.is_authenticated = {{ is_granted("IS_AUTHENTICATED_REMEMBERED")|serialize|raw }};
  64. app_data.messaging_api_key = "{{ firebase_api_key }}";
  65. app_data.messaging_sender_id = "{{ firebase_sender_id }}";
  66. app_data.country = "{{ get_setting('general', 'country') | lower }}";
  67. app_data.topBar = "{{ topBar is not null ? true : false }}";
  68. app_data.topBarStarts = "{{ topBar is not null ? topBar.startAt : false }}";
  69. app_data.topBarCounter = "{{ topBar is not null ? topBar.counter : false }}";
  70. app_data.environment = "{{ app.environment }}"
  71. app_data.currency = "{{ get_setting('general', 'currency')|trans }}"
  72. app_data.searchSvcUrl="{{search_service_public_endpoint}}"
  73. </script>
  74. <script type="application/ld+json">
  75. {
  76. "@context": "https://schema.org",
  77. "@type": "Organization",
  78. "logo" : "{{ app.request.locale == 'ar' ? absolute_url(asset('images/logo-ar.svg')) : absolute_url(asset('images/EnglishLogo.png')) }}",
  79. "url": "{{ app.request.getSchemeAndHttpHost() }}"
  80. }
  81. </script>
  82. {% endblock %}
  83. {% block env %}
  84. {% include "env.html.twig" %}
  85. {% endblock %}
  86. </head>
  87. <body class="{{ 'layout.direction_code'|trans }} {{ adminBodyClass }} {{ searchResultsBodyClass }}">
  88. {% if isProduction and not isGoogleTagManagerDisabledTest %}
  89. <!-- Google Tag Manager -->
  90. <script>
  91. var tagManagerSettings = '{{ get_setting('general', 'tag_manager') }}';
  92. var allowTagManagerDelay = '{{allowTagManagerDelay}}'
  93. </script>
  94. <noscript><iframe src="//www.googletagmanager.com/ns.html?id={{ get_setting('general', 'tag_manager') }}"
  95. height="0" width="0" style="display:none;visibility:hidden" loading="lazy"></iframe></noscript>
  96. <script type="application/javascript" src="{{ asset('builds/js/buildTagManager'~ (app.environment == 'dev' ? '' : '.min') ~'.js') }}"></script>
  97. <!-- End Google Tag Manager -->
  98. {% endif %}
  99. {% block googleDoubleclick %}
  100. {% if isProduction and isUXVersion %}
  101. <script src="https://securepubads.g.doubleclick.net/tag/js/gpt.js"></script>
  102. <script>
  103. window.googletag = window.googletag || {cmd: []};
  104. googletag.cmd.push(function() {
  105. googletag.pubads().enableSingleRequest();
  106. googletag.pubads().collapseEmptyDivs();
  107. googletag.pubads().setTargeting('lang', "{{ app.request.locale }}").setTargeting('url', "{{ app.request.pathInfo }}");
  108. });
  109. {% if get_setting('general', 'country') == 'SA' %}
  110. googletag.cmd.push(function() {
  111. googletag.defineSlot('/34628225/Frontpage-KSA', [[1140, 225], [728, 144]], 'div-gpt-ad-1611048992201-0').addService(googletag.pubads());
  112. googletag.enableServices();
  113. });
  114. {% else %}
  115. googletag.cmd.push(function() {
  116. googletag.defineSlot('/34628225/half-page', [1140, 225], 'div-gpt-ad-1588539416603-0').addService(googletag.pubads());
  117. googletag.enableServices();
  118. });
  119. {% endif %}
  120. </script>
  121. <script>
  122. window.googletag = window.googletag || {cmd: []};
  123. googletag.cmd.push(function() {
  124. googletag.pubads().enableSingleRequest();
  125. googletag.pubads().collapseEmptyDivs();
  126. googletag.pubads().setTargeting('lang', "{{ app.request.locale }}").setTargeting('url', "{{ app.request.pathInfo }}");
  127. });
  128. {% if get_setting('general', 'country') == 'SA' %}
  129. googletag.cmd.push(function() {
  130. googletag.defineSlot('/34628225/sideadksalong', [300, 600], 'div-gpt-ad-1638434718795-0').addService(googletag.pubads());
  131. googletag.enableServices();
  132. });
  133. {% else %}
  134. googletag.cmd.push(function() {
  135. googletag.defineSlot('/34628225/sideadlong', [300, 600], 'div-gpt-ad-1638434601381-0').addService(googletag.pubads());
  136. googletag.enableServices();
  137. });
  138. {% endif %}
  139. </script>
  140. <script>
  141. window.googletag = window.googletag || {cmd: []};
  142. googletag.cmd.push(function() {
  143. googletag.pubads().enableSingleRequest();
  144. googletag.pubads().collapseEmptyDivs();
  145. googletag.pubads().setTargeting('lang', "{{ app.request.locale }}").setTargeting('url', "{{ app.request.pathInfo }}");
  146. });
  147. {% if get_setting('general', 'country') == 'SA' %}
  148. googletag.cmd.push(function() {
  149. googletag.defineSlot('/34628225/feedadksa', [320, 320], 'div-gpt-ad-1611049193067-0').addService(googletag.pubads());
  150. googletag.enableServices();
  151. });
  152. {% else %}
  153. googletag.cmd.push(function() {
  154. googletag.defineSlot('/34628225/feedad', [320, 320], 'div-gpt-ad-1588541966744-0').addService(googletag.pubads());
  155. googletag.enableServices();
  156. });
  157. {% endif %}
  158. </script>
  159. {% endif %}
  160. {% endblock %}
  161. {% block searchFilters %}
  162. {% endblock %}
  163. {% block firebase %}
  164. <div id="overlay-back"></div>
  165. <div id="overlay"><div class="overlay-text">{{ 'notification_modal.info_message'|trans }} </div></div>
  166. {% endblock %}
  167. {% block vueBody %}
  168. {% include "flashes.html.twig" %}
  169. {% set vueAppName = isListingDetailsPage ? "activitiesApp" : "vueApp" %}
  170. <div id="{{vueAppName}}"
  171. data-feature-toggle="{{ featureToggle is defined ? featureToggle|json_encode : null }}"
  172. data-user="{{ app.user ? app.user.id : null }}"
  173. data-user-email="{{ app.user ? app.user.email : null }}">
  174. {% block navigation %}
  175. {% include "header.html.twig" %}
  176. {% endblock %}
  177. {% if app.request.attributes.get('_route') == 'homepage' %}
  178. {% include "hero-searchbar.html.twig" %}
  179. <section class="container-fluid">
  180. <div class="row justify-content-center">
  181. {% if isProduction %}
  182. {% if get_setting('general', 'country') == 'SA' %}
  183. <div id='div-gpt-ad-1611048992201-0' style='width: 1140px; height: 225px;'>
  184. <script type="application/javascript" v-pre defer>
  185. if (typeof googletag !== 'undefined') {
  186. googletag.cmd.push(function() { googletag.display('div-gpt-ad-1611048992201-0'); });
  187. }
  188. </script>
  189. </div>
  190. {% else %}
  191. <div id='div-gpt-ad-1588539416603-0' style='width: 1140px; height: 225px;'>
  192. <script type="application/javascript" v-pre defer>
  193. if (typeof googletag !== 'undefined') {
  194. googletag.cmd.push(function() { googletag.display('div-gpt-ad-1588539416603-0'); });
  195. }
  196. </script>
  197. </div>
  198. {% endif %}
  199. {% else %}
  200. <div class="takeover-ad" style="text-align: center; background-color: {{ get_setting('features', 'takeover_ad_color') }};">
  201. <img src="https://placehold.it/1140x225/DFDFDF/B6B6B6&text=AD%20BANNER%20(1140%20X%20225)" width="100%" alt="" />
  202. </div>
  203. {% endif %}
  204. </div>
  205. </section>
  206. {% endif %}
  207. {% block headerTop %}
  208. {% include "adsHeader.html.twig" %}
  209. {% endblock %}
  210. {% block body %}
  211. {% endblock %}
  212. {% block modals %}
  213. {% endblock %}
  214. </div>
  215. {% endblock %}
  216. {% block footer %}
  217. {% set hiddenFooterRoutes = ['listing_initialize', 'listing_edit', 'listing_upload', 'listing_confirm_publish_credit'] %}
  218. {% if app.request.attributes.get('_route') not in hiddenFooterRoutes %}
  219. {% include "footer.v2.html.twig" %}
  220. {% endif %}
  221. {% endblock %}
  222. {% block stylesheets -%}
  223. {% if ('layout.direction_code'|trans) == 'rtl' -%}
  224. <link href="{{ asset('builds/css/bootstrap-rtl.min.css') }}" rel="stylesheet" media="print" onload="this.media='all';this.onload=null;" />
  225. {% endif -%}
  226. {% endblock %}
  227. {% block getTranslations %}
  228. {% include "get-translations.html.twig" %}
  229. {% endblock %}
  230. <!-- Javascript categorized files -->
  231. {% block categorizedJavascripts %}
  232. <script src="{{ asset('builds/js/build'~ (app.environment == 'dev' ? '' : '.min') ~'.js') }}"></script>
  233. <script defer type="application/javascript" src="{{ asset('builds/js/buildTopSellers'~ (app.environment == 'dev' ? '' : '.min') ~'.js') }}"></script>
  234. {% if topBar is not null %}
  235. {{ encore_entry_script_tags('countdown') }}
  236. {% endif %}
  237. {% endblock %}
  238. <!-- Javascript files -->
  239. {% block javascripts %}
  240. <script src="{{ asset('js/translations/jstranslation/'~ app.request.locale ~'.js') }}" defer></script>
  241. <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
  242. <!--[if lt IE 9]>
  243. <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
  244. <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
  245. <![endif]-->
  246. <script type="application/javascript">
  247. // Google Tag Manager Data Layer initialization
  248. window.dataLayer = window.dataLayer || [];
  249. // Translator initialization
  250. window.Translator = window.Translator || [];
  251. </script>
  252. {# Criteo Custom DataLayer #}
  253. {% set criteo_custom_datalayer = {'PageType': 'TransactionPage', 'email': ' '} %}
  254. {# Criteo DataLayer #}
  255. {% set criteo_datalayer = {'PageType': app.request.attributes.get('_route')} %}
  256. {% if app.request.attributes.get('_route') == 'search' or app.request.attributes.get('_route') == 'property_type_search' -%}
  257. {% set criteo_datalayer = {'PageType': 'search'} %}
  258. {% endif %}
  259. {% set criteo_datalayer = criteo_datalayer|merge({'email': ' '}) %}
  260. {% if app.request.attributes.get('_route') == 'listing_slug' %}
  261. {% set criteo_datalayer = {'PageType': 'ListingPage', 'email': ' '} %}
  262. {% set criteo_custom_datalayer = criteo_custom_datalayer|merge({'ProductTransactionProducts': [{ 'id': listing.id , 'price': '0.01' , 'quantity': '1' }]}) %}
  263. {% set criteo_datalayer = criteo_datalayer|merge({'ListingID': listing.id}) %}
  264. <script>
  265. $(document).ready(function () {
  266. dataLayer.push({{ criteo_custom_datalayer|json_encode|raw }});
  267. });
  268. </script>
  269. {% if listing.liveChildren is not empty %}
  270. {% set criteo_datalayer = criteo_datalayer|merge({'unitsIDs': listing.liveChildrenIDs}) %}
  271. {% endif -%}
  272. {% endif %}
  273. {% if app.request.attributes.get('_route') == 'search' or app.request.attributes.get('_route') == 'property_type_search' -%}
  274. {% set criteo_datalayer = criteo_datalayer|merge({'ListingIDList': resultsIDs|slice(1, 3)}) %}
  275. {% endif %}
  276. <script>
  277. $(document).ready(function () {
  278. dataLayer.push({{ criteo_datalayer|json_encode|raw }});
  279. });
  280. </script>
  281. {% endblock %}
  282. {% block fos %}
  283. {% if app.debug %}
  284. <script src="{{ path('fos_js_routing_js', {"callback": "fos.Router.setData"}) }}"></script>
  285. {% else %}
  286. <script src="{{ asset('js/fos_js_routes.js') }}"></script>
  287. <script>
  288. Routing.setPrefix("{{ app.request.locale }}__RG__");
  289. </script>
  290. {% endif %}
  291. {% endblock %}
  292. {% block extraScripts %}
  293. {% if app.request.attributes.get('_route') == 'homepage' %}
  294. <script type="application/javascript" src="{{ asset('js/priceFilters.js') }}"></script>
  295. {% endif %}
  296. {% endblock extraScripts %}
  297. {% block wootricScript %}
  298. {% if isUXVersion %}
  299. <!-- begin Wootric code -->
  300. <script>
  301. window.wootric = function(){};
  302. </script>
  303. <script type="text/javascript" src="https://cdn.wootric.com/wootric-sdk.js"></script>
  304. {% if app.user %}
  305. <script id="wootricScript" type="application/javascript" src="{{ asset('builds/js/buildWootric'~ (app.environment == 'dev' ? '' : '.min') ~'.js') }}"></script>
  306. {% else %}
  307. <script type="text/javascript">
  308. //window.wootric_survey_immediately = true; // Shows survey immediately for testing purposes. TODO: Comment out for production.
  309. window.wootricSettings = {
  310. account_token: 'NPS-8fa9e73b'
  311. };
  312. window.wootric("run");
  313. </script>
  314. {% endif %}
  315. {% else %}
  316. <script>
  317. $(document).ready(function () {
  318. {% if app.user %}
  319. dataLayer.push({
  320. 'userEmail': '{{ app.user.email }}',
  321. 'userCreatedAt': '{{ app.user.createdAt|date('U') }}',
  322. });
  323. {% endif %}
  324. });
  325. </script>
  326. {% endif %}
  327. {% endblock %}
  328. {% block facebookLogin %}
  329. {% endblock %}
  330. {% block googleLogin %}
  331. {% include "googleLogin.html.twig" %}
  332. {% endblock googleLogin %}
  333. </body>
  334. </html>