/
base.html
377 lines (323 loc) · 14.2 KB
/
base.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
{%- if current_language -%}
{% set language = current_language %}
{%- elif page and page.language -%}
{% set language = page.language %}
{%- else -%}
{% set language = 'en' %}
{% endif -%}
<!DOCTYPE html>
{% if flag_enabled('CFPB_RECRUITING') %}
<!--
============================================================================
Hey! If you're viewing this, you should probably come work on our Technology
& Innovation team. We're always looking for a few great designers,
developers, data scientists, and network, infrastructure, privacy and
security pros. Keep an eye on our job opportunities at:
https://www.consumerfinance.gov/jobs/
Also, you can see more of our code at https://github.com/cfpb
============================================================================
-->
{% endif %}
<html lang="{{ language }}" class="no-js"
{%- if is_faq_page %}
itemscope="" itemtype="https://schema.org/FAQPage"
{% endif -%}>
<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# {% block og_article_prefix %}{% endblock %}">
{#
===========
GLOBAL META
===========
#}
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta charset="utf-8">
{% block meta_viewport %}
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
{% endblock meta_viewport %}
{#
==================
PAGE-SPECIFIC META
==================
#}
<title>
{%- block title -%}
{%- if page -%} {{ page.seo_title or page.title }} | {% endif -%}
{{ _('Consumer Financial Protection Bureau') }}
{%- endblock title -%}
</title>
<meta name="template" content="{{ self._TemplateReference__context.name }}">
<meta name="description"
content="
{%- block desc -%}
{{- meta_description if page else '' -}}
{%- endblock -%}
">
{# Always open preview panel links in a new tab. #}
{% if request.in_preview_panel %}
<base target="_blank">
{% endif %}
{%- block canonical -%}
{% set canonical = request.build_absolute_uri(request.path) | lower %}
<link rel="canonical" href="{{ canonical }}">
<meta property="og:url" content="{{ canonical }}">
{%- endblock -%}
{# Open Graph properties #}
{# Required Open Graph properties #}
<meta property="og:title" content="{% block og_title %}{{ self.title() }}{% endblock %}">
<meta property="og:type" content="{% block og_type %}website{% endblock %}">
{% block og_image %}
{% if page and page.meta_image %}
{% set meta_image_url = request.build_absolute_uri(image(page.meta_image, 'original').url) %}
<meta property="og:image" content="{{ meta_image_url }}">
<meta property="twitter:image" content="{{ meta_image_url }}">
{% if page.meta_image.should_display_summary_large_image %}
<meta name="twitter:card" content="summary_large_image">
{% endif %}
{% else %}
<meta property="og:image"
content="{{ request.scheme }}://{{ request.get_host() }}{{ static('img/logo_open-graph_facebook.png') }}">
<meta property="twitter:image"
content="{{ request.scheme }}://{{ request.get_host() }}{{ static('img/logo_open-graph_twitter.png') }}">
{% endif %}
{% endblock og_image %}
{# Optional Open Graph properties #}
<meta property="og:description"
content="
{%- block og_desc -%}
{%- if page -%}
{{- page.search_description or page.seo_title or page.title -}}
{%- endif -%}
{%- endblock -%}
">
<meta property="og:site_name" content="{% block og_site_name %}Consumer Financial Protection Bureau{% endblock %}">
{# Facebook Open Graph properties #}
<meta property="fb:app_id" content="210516218981921">
{% block og_page_id %}{% endblock %}
{% block og_article_author %}{% endblock %}
{# End of Open Graph properties #}
<link rel="icon" href="{{ static('favicon.ico') }}" sizes="any">
<link rel="icon" href="{{ static('icon.svg') }}" type="image/svg+xml">
<link rel="apple-touch-icon" href="{{ static('apple-touch-icon.png') }}">
<link rel="manifest" href="{{ static('site.webmanifest') }}">
{#
======
STYLES
======
The number of stylesheets here must be kept to a minimum.
Unless adding a significant amount of CSS that is specific to a single page or
section of the site, all new styles should be added to cfgov/v1/unprocessed/css/main.less.
#}
{% block css %}
<link rel="stylesheet" href="{{ static('css/main.css') }}">
{% if page and page.media_css %}
{% for css in page.media_css %}
<link rel="stylesheet" href="{{ static('css/on-demand/' + css) }}" />
{% endfor %}
{% endif %}
{% endblock css %}
{#
======
PRELOADING DYNAMIC ASSETS
======
#}
{% block preload %}
<link rel="preload" href="{{ static('css/main.css') }}" as="style">
<link rel="preload"
href="{{ static('fonts/2cd55546-ec00-4af9-aeca-4a3cd186da53.woff2') }}"
as="font"
type="font/woff2" crossorigin>
<link rel="preload"
href="{{ static('fonts/627fbb5a-3bae-4cd9-b617-2f923e29d55e.woff2') }}"
as="font"
type="font/woff2" crossorigin>
<link rel="preload" href="{{ static('js/routes/common.js') }}" as="script">
{# Preconnecting comes from the 3rd best practice in
https://developer.mozilla.org/en-US/docs/Web/Performance/dns-prefetch#best_practices #}
<link rel="preconnect" href="//google-analytics.com/" crossorigin>
<link rel="dns-prefetch" href="//google-analytics.com/">
<link rel="preconnect" href="//googletagmanager.com/" crossorigin>
<link rel="dns-prefetch" href="//googletagmanager.com/">
<link rel="preconnect" href="//js-agent.newrelic.com/" crossorigin>
<link rel="dns-prefetch" href="//js-agent.newrelic.com/">
{# These domains are called on pages with youtube videos. #}
<link rel="dns-prefetch" href="//ytimg.com/">
<link rel="dns-prefetch" href="//doubleclick.net/">
{% endblock preload %}
{#
============
HEAD SCRIPTS
============
The following scripts must be included in the head. DO NOT ADD ANY MORE.
All other scripts should go before the closing body tag.
If you come across a script that makes a convincing case to be included in
the head, then file an issue or PR to discuss including it.
#}
{# Don't load certain scripts in the Wagtail preview panel. -#}
{% if not request.in_preview_panel %}
{% if flag_enabled('AB_TESTING') %}
{# Begin Google Optimize #}
{# Optimize anti-flicker snippet. #}
<style>.async-hide { opacity: 0 !important} </style>
<script>(function(a,s,y,n,c,h,i,d,e){s.className+=' '+y;h.start=1*new Date;
h.end=i=function(){s.className=s.className.replace(RegExp(' ?'+y),'')};
(a[n]=a[n]||[]).hide=h;setTimeout(function(){i();h.end=null},c);h.timeout=c;
})(window,document.documentElement,'async-hide','dataLayer',4000,
{'GTM-KMMLRS':true});</script>
{#
NOTE: We don't include the googleoptimize.com/optimize.js script call here
because we are including optimize via GTM.
#}
{# End Google Optimize #}
{% endif %}
{# Begin Google Tag Manager #}
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;
f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-KMMLRS');</script>
{# End Google Tag Manager #}
{# End: Don't load certain scripts in the Wagtail preview panel. #}
{% endif -%}
{% block javascript_loader %}
<script>
{# Minified dynamic JavaScript loader that injects a script tag in the head of the page. #}
function jsl(a){
if(window.fetch){
for(var b,c,d=[],f=document.scripts[0];b=a.shift();)c=document.createElement("script"),"async"in c?(c.async=!1,c.src=b,document.head.appendChild(c)):(d.push(c),c.onreadystatechange=function(){for(var e;d[0]&&"loaded"==d[0].readyState;)e=d.shift(),e.onreadystatechange=null,f.parentNode.insertBefore(e,f)},c.src=b);
}
}
</script>
{% endblock javascript_loader %}
<script>
if(window.fetch){
document.documentElement.className = document.documentElement.className.replace('no-js', 'js')
}
</script>
</head>
<body{% block body_classes %}{% endblock body_classes %}>
{#
=========
Analytics
=========
#}
{% block analytics %}
{# Don't load certain scripts in the Wagtail preview panel. -#}
{% if not request.in_preview_panel %}
{# Google Tag Manager (noscript) #}
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-KMMLRS"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
{# End Google Tag Manager (noscript) #}
{# End: Don't load certain scripts in the Wagtail preview panel. #}
{% endif -%}
{% endblock analytics %}
{% block body %}
{# Overlay for the page. Used for the mobile mega menu. #}
<div class="a-overlay u-hidden"></div>
<div class="skip-nav">
<a class="skip-nav__link"
href="{% block skip_nav_target %}#main{% endblock %}">
{{ _('Skip to main content') }}
</a>
</div>
{% block header %}
{% import 'v1/includes/organisms/header.html' as o_header with context %}
{{ o_header.render(
show_mega_menu=true,
language=language
) }}
{% endblock header %}
{% block wagtailuserbar %}
{#
WAGTAILUSERBAR IN-PAGE VIEW CONTROLS
If you _don't_ want this to show up in a particular template,
add an empty wagtailuserbar block to that template.
#}
{{ wagtailuserbar() }}
{% endblock %}
{% block banner_top %}
{% endblock %}
{# PRIMARY CONTENT #}
{% block content %}
{# This will be replaced in templates that extend this template
and override "content". #}
{% endblock content %}
{# /PRIMARY CONTENT #}
{% block banner_bottom %}
{% endblock %}
{% block footer %}
{% import 'v1/includes/organisms/footer.html' as o_footer with context %}
{{ o_footer.render( language ) }}
{% endblock footer %}
{% endblock body %}
{#
============
BODY SCRIPTS
============
The number of scripts here must be kept to a minimum.
#}
{% block javascript scoped %}
<script>
if ( window.fetch ) {
!function(){
{# Include site-wide JavaScript. #}
var s = [ '{{ static('js/routes/common.js') }}' ];
{#
Check and include template-level JavaScript.
Template-level JavaScript applies to all pages under the URL scheme
www.consumerfinance.gov/[app-url]/
and JavaScript appears in unprocessed/js/routes/[app-url]/single.js.
#}
{% macro template_js() %}
{% include 'js/routes/' + app_url(request) + '/single.js' ignore missing %}
{% endmacro %}
{% set js_source = template_js() | trim %}
{% if js_source | length > 0 %}
s.push( '{{ static('js/routes/' + app_url(request) + '/single.js') }}' );
{% endif %}
{#
Check and include component-level JavaScript.
Component-level JavaScript adds scripts appearing in
unprocessed/js/routes/on-demand/[component].js
to the page, based on what components were added in Wagtail.
#}
{% if page and page.media_js %}
{% for js in page.media_js %}
{% if 'https://' in js %}
s.push('{{ js }}');
{% else %}
s.push( '{{ static('js/routes/on-demand/' + js) }}' );
{% endif %}
{% endfor %}
{% endif %}
{#
Check and include page-level JavaScript.
Page-level JavaScript applies to a single pages under the URL scheme
www.consumerfinance.gov/[app-url]/somepage
and JavaScript appears in unprocessed/js/routes/[app-url]/index.js.
#}
{% macro page_js() %}
{% include 'js/routes/' + app_page_url(request) + 'index.js' ignore missing %}
{% endmacro %}
{% set js_source = page_js() | trim %}
{% if js_source | length > 0 %}
s.push( '{{ static('js/routes/' + app_page_url(request) + 'index.js') }}' );
{% endif %}
{# Pass scripts to JavaScript loader. #}
jsl(s);
}();
}
</script>
{% if flag_enabled('PATH_MATCHES_FOR_QUALTRICS') %}
<script type='text/javascript'>
(function(){var g=function(e,h,f,g){
this.get=function(a){for(var a=a+"=",c=document.cookie.split(";"),b=0,e=c.length;b<e;b++){for(var d=c[b];" "==d.charAt(0);)d=d.substring(1,d.length);if(0==d.indexOf(a))return d.substring(a.length,d.length)}return null};
this.set=function(a,c){var b="",b=new Date;b.setTime(b.getTime()+6048E5);b="; expires="+b.toGMTString();document.cookie=a+"="+c+b+"; path=/; "};
this.check=function(){var a=this.get(f);if(a)a=a.split(":");else if(100!=e)"v"==h&&(e=Math.random()>=e/100?0:100),a=[h,e,0],this.set(f,a.join(":"));else return!0;var c=a[1];if(100==c)return!0;switch(a[0]){case "v":return!1;case "r":return c=a[2]%Math.floor(100/c),a[2]++,this.set(f,a.join(":")),!c}return!0};
this.go=function(){if(this.check()){var a=document.createElement("script");a.type="text/javascript";a.src=g;document.body&&document.body.appendChild(a)}};
this.start=function(){var t=this;"complete"!==document.readyState?window.addEventListener?window.addEventListener("load",function(){t.go()},!1):window.attachEvent&&window.attachEvent("onload",function(){t.go()}):t.go()};};
try{(new g(100,"r","QSI_S_ZN_eLsXNyVBrTKgTHM","https://znelsxnyvbrtkgthm-cfpbfedramp.gov1.siteintercept.qualtrics.com/SIE/?Q_ZID=ZN_eLsXNyVBrTKgTHM")).start()}catch(i){}})();
</script><div id='ZN_eLsXNyVBrTKgTHM'><!--DO NOT REMOVE-CONTENTS PLACED HERE--></div>
{% endif %}
{% endblock javascript %}
</body>
</html>