-
Notifications
You must be signed in to change notification settings - Fork 14
/
base.html.twig
183 lines (168 loc) · 8.57 KB
/
base.html.twig
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
<!doctype html>
<html dir="{{ site.textDirection|default('ltr') }}" lang="{{ site.locale|default('en') }}" class="no-js">
<head>
{% set info_notes = page.messages.info ?? [] -%}
{%- set success_notes = page.messages.success ?? [] -%}
{%- set warning_notes = page.messages.warning ?? [] -%}
{%- set error_notes = page.messages.error ?? [] -%}
{%- set thumbnail = page.thumbnailImage.0.src|default(absolute_url(asset('images/w3c-opengraph-image.png', 'website-2021'))) -%}
<title>
{%- block documenttitle -%}
{%- set title_acl -%}
{%- if page.access_control is defined -%}
{%- if page.access_control.text is defined -%}
({{ page.access_control.text }})
{%- else -%}
{%- if page.access_control.acl is defined -%}
{%- set acl = page.access_control.acl -%}
{%- else -%}
{%- set acl = 'private' -%}
{%- endif -%}
({{ ('page.acl.' ~ acl)|trans({}, 'w3c_website_templates_bundle') }})
{%- endif -%}
{%- endif -%}
{%- endset -%}
{%- if error_notes|length > 0 -%}Error: {% endif -%}
{# recursively produces title from breadcrumbs, including acl info if present #}
{%- macro title(breadcrumb, title_acl=null) -%}
{%- if breadcrumb.parent is defined and breadcrumb.parent -%}
{{- breadcrumb.title }}{{ title_acl ? ' ' ~ title_acl : '' }} | {{ _self.title(breadcrumb.parent) }}
{%- else -%}
W3C
{%- endif -%}
{%- endmacro -%}
{% if page.breadcrumbs is defined and page.breadcrumbs %}
{{- _self.title(page.breadcrumbs, title_acl) -}}
{% elseif page.title is defined and page.title != 'W3C' %}
{{- page.title }} | W3C
{%- else -%}
W3C
{%- endif -%}
{%- endblock -%}
</title>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="{% block description %}{{ page.excerpt|default('page.default_description'|trans({}, 'w3c_website_templates_bundle')) }}{% endblock %}"/>
<meta name="thumbnail" content="{{ thumbnail }}"/>
{# <meta property="fb:app_id" content="__hardcoded_fb_app_id__"> #}
<meta property="og:url" content="{{ app.request.uri }}"/>
<meta property="og:type" content="website"/>
<meta property="og:title" content="{{ page.title|default('W3C') }}"/>
<meta property="og:image" content="{{ thumbnail }}"/>
<meta property="og:image:width" content="1200"/>
<meta property="og:image:height" content="630"/>
<meta property="og:description" content="{{ block('description') }}"/>
<meta property="og:site_name" content="W3C"/>
{# <meta property="og:locale" content="{{ locale|replace('-', '_') }}"/> #}
{#
{% for locale in locales -%}
<meta property="og:locale:alternate" content="{{ locale|replace('-', '_') }}"/>
{% endfor %}
#}
<meta name="twitter:card" content="summary_large_image"/>
<meta name="twitter:site" content="w3c"/>
<meta name="twitter:url" content="{{ app.request.uri }}"/>
<meta name="twitter:title" content="{{ page.title|default('W3C') }}"/>
<meta name="twitter:description" content="{{ block('description') }}"/>
<meta name="twitter:image" content="{{ thumbnail }}"/>
{%- if page.expiryDate is defined and page.expiryDate -%}
<meta name="robots" content="unavailable_after: {{ page.expiryDate }}"/>
{% endif %}
<link rel="home" href="https://www.w3.org/"/>
<link rel="icon" type="image/png" href="https://www.w3.org/assets/logos/w3c/favicon-32.png"/>
<link rel="apple-touch-icon" type="image/png" href="https://www.w3.org/assets/logos/w3c/favicon-180.png"/>
{% block stylesheets %}
<link rel="stylesheet" href="{{ asset('styles/core.css?ver=1.4', 'website-2021') }}" media="screen"/>
<!--
CSS Mustard Cut
Print (Edge doesn't apply to print otherwise)
Edge, Chrome 39+, Opera 26+, Safari 9+, iOS 9+, Android ~5+, Android UCBrowser ~11.8+
FF 47+
-->
<link rel="stylesheet" id="advanced-stylesheet"
href="{{ asset('styles/advanced.css?ver=1.4', 'website-2021') }}" media="
only print,
only all and (pointer: fine), only all and (pointer: coarse), only all and (pointer: none),
only all and (min--moz-device-pixel-ratio:0) and (display-mode:browser), (min--moz-device-pixel-ratio:0) and (display-mode:fullscreen)
">
<link rel="stylesheet" href="{{ asset('styles/print.css', 'website-2021') }}" media="print"/>
{% endblock stylesheets %}
{% block javascripts %}
<script src="{{ asset('js/libraries/fontfaceobserver.js', 'website-2021') }}"></script>
<script>
var myFont = new FontFaceObserver('Noto Sans');
Promise.all([myFont.load()]).then(function () {
document.documentElement.className += " fonts-loaded";
});
(function () {
var linkEl = document.getElementById('advanced-stylesheet');
if (window.matchMedia && window.matchMedia(linkEl.media).matches) {
var script = document.createElement('script');
script.src = '{{ asset('js/main.js?ver=1.4', 'website-2021') }}';
script.defer = true;
document.querySelector('head').appendChild(script);
(function (H) {
H.className = H.className.replace(/\bno-js\b/, 'js')
})(document.documentElement);
}
})();
</script>
{% endblock javascripts %}
{% if page.feeds is defined %}
{% for feed in page.feeds %}
<link href="{{ feed.href }}" title="{{ feed.title }}" rel="alternate" type="application/rss+xml" />
{% endfor %}
{% endif %}
{% block head_other %}{% endblock %}
</head>
<body {% block body_classes %}class="{{ body_classes|default('default') }}"{% endblock %}>
<a class="skip-link" href="#main">{{ 'page.skip_to_content'|trans({}, 'w3c_website_templates_bundle') }}</a>
<div class="grid-wrap">
<div class="wrap">
<header class="global-header">
<span role="status" aria-live="polite"></span>
{# % block banner %}
{{ include('@W3CWebsiteTemplates/components/styles/banner.html.twig') }}
{% endblock banner %#}
{% block access_control %}
{{ include('@W3CWebsiteTemplates/components/styles/access_control.html.twig') }}
{% endblock %}
{% block lang_nav %}
{{ include('@W3CWebsiteTemplates/components/styles/lang_nav.html.twig') }}
{% endblock lang_nav %}
{% block global_nav %}
{% embed '@W3CWebsiteTemplates/components/styles/global_nav.html.twig' with {
'navigation': navigation|default([])
} %}{% endembed %}
{% endblock global_nav %}
</header>
{% block breadcrumbs %}
{% embed '@W3CWebsiteTemplates/components/styles/breadcrumbs.html.twig' with {
'breadcrumbs': page.breadcrumbs is defined ? page.breadcrumbs : {}
} %}{% endembed %}
{% endblock breadcrumbs %}
<main id="main" {% block extra_main_attributes %}{{ extra_main_attributes|default('')|raw }}{% endblock %}>
{% import '@W3CWebsiteTemplates/components/styles/notes.html.twig' as notes %}
{{ notes.errors(error_notes) }}
{{ notes.successes(success_notes) }}
{{ notes.warnings(warning_notes) }}
{{ notes.info(info_notes) }}
{% block notes %}{% endblock %}
{% block main %}{% endblock %}
{% block pre_footer %}{% endblock %}
</main>
{% block crosslinks %}
{% if crosslinks is defined and crosslinks['links'] is defined and crosslinks['links']|length > 0 %}
{{ include('@W3CWebsiteTemplates/components/styles/crosslinks.html.twig') }}
{% endif %}
{% endblock crosslinks %}
</div>
{% block footer %}
{% embed '@W3CWebsiteTemplates/components/styles/footer.html.twig' with {
'links': footerlinks is defined ? footerlinks : {}
} %}{% endembed %}
{% endblock %}
</div>
{% block closing_body_scripts %}{% endblock %}
</body>
</html>