-
Notifications
You must be signed in to change notification settings - Fork 4
/
macros_head.html
430 lines (357 loc) · 15.1 KB
/
macros_head.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
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
<CONTENT VERSION="1.0" LANG="fr" CHARSET="utf-8"/>
/**
* Macro principale appelée par les templates pour consituer le head.
*/
<DEFMACRO NAME="HEAD_MAIN">
<MACRO NAME="HEAD_METADONNEES" />
<MACRO NAME="HEAD_INSERT_CSS" />
<MACRO NAME="HEAD_INSERT_FAVICON" />
<MACRO NAME="HEAD_INSERT_RSS" />
<MACRO NAME="HEAD_INSERT_JS" />
</DEFMACRO>
/**
* Métadonnées.
*/
<DEFMACRO NAME="HEAD_METADONNEES">
<MACRO NAME="HEAD_META_INIT"/>
<MACRO NAME="HEAD_META_HTML"/>
<MACRO NAME="HEAD_META_DC"/>
<IF COND="[#CLASS] EQ 'textes'">
<MACRO NAME="HEAD_META_HWP"/>
</IF>
<MACRO NAME="HEAD_META_OG"/>
<MACRO NAME="HEAD_META_TWITTER"/>
</DEFMACRO>
/**
* Initialisation de variables pour constituer les métadonnées.
*/
<DEFMACRO NAME="HEAD_META_INIT">
<!--[ Variables utiles ]-->
<LET VAR="titre_complet"><FUNC NAME="BASE_CONCAT_TITLES" TITRE="[#TITRE|removenotes|textebrut|cleanBadChars|replacequotationmark|trim]" SOUSTITRE="[#SOUSTITRE|removenotes|textebrut|cleanBadChars|replacequotationmark|trim]" /></LET>
<LET VAR="titresite_complet"><FUNC NAME="BASE_CONCAT_TITLES" TITRE="[#OPTIONS.METADONNEESSITE.TITRESITE|textebrut|cleanBadChars|replacequotationmark|trim]" SOUSTITRE="[#OPTIONS.METADONNEESSITE.SOUSTITRESITE|textebrut|cleanBadChars|replacequotationmark|trim]" /></LET>
<!--[ Dates ]-->
<LET VAR="publication_date"></LET>
<LET VAR="online_date"></LET>
<LET VAR="modification_date"></LET>
<IF COND="[#DATEMISENLIGNE|isadate] AND [#DATEMISENLIGNE] NE '0000-00-00' AND [#DATEMISENLIGNE] NE NULL" >
<LET VAR="publication_date">[#DATEMISENLIGNE]</LET>
<LET VAR="online_date">[#DATEMISENLIGNE]</LET>
<LET VAR="modification_date">[#DATEMISENLIGNE]</LET>
</IF>
<IF COND="[#DATEPUBLI|isadate] AND [#DATEPUBLI] NE '0000-00-00' AND [#DATEPUBLI] NE NULL" >
<LET VAR="publication_date">[#DATEPUBLI]</LET>
<LET VAR="online_date">[#DATEPUBLI]</LET>
</IF>
<IF COND="[#DATEPUBLIPAPIER|isadate] AND [#DATEPUBLIPAPIER] NE '0000-00-00' AND [#DATEPUBLIPAPIER] NE NULL">
<LET VAR="publication_date">[#DATEPUBLIPAPIER]</LET>
</IF>
<IF COND="[#MODIFICATIONDATE|isadate] AND [#MODIFICATIONDATE] NE '0000-00-00' AND [#MODIFICATIONDATE] NE NULL">
<LET VAR="modification_date">[#MODIFICATIONDATE]</LET>
</IF>
</DEFMACRO>
/**
* HTML meta tags.
*/
<DEFMACRO NAME="HEAD_META_HTML">
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>[%TITRE_PAGE|trim()]</title>
<meta name="generator" content="Lodel [#VERSION]" />
<IF COND="[#OPTIONS.METADONNEESSITE.DESCRIPTIONSITE]">
<meta name="description" content="[#OPTIONS.METADONNEESSITE.DESCRIPTIONSITE|textebrut|cleanBadChars|replacequotationmark|trim]" />
</IF>
<meta name="URL" content="[#CURRENTURL_FIXED]" />
<FUNC NAME="HEAD_META_AUTHORS" NAME_VALUE="author" />
<FUNC NAME="HEAD_META_KEYWORDS" NAME_VALUE="keywords" />
</DEFMACRO>
/**
* Metadonnées Dublin Core.
*/
<DEFMACRO NAME="HEAD_META_DC">
<!--[ Schemas ]-->
<link rel="schema.DC" href="http://purl.org/dc/elements/1.1/" />
<link rel="schema.DCTERMS" href="http://purl.org/dc/terms/" />
<!--[ DC.description ]-->
<IF COND="[#RESUME]">
<LET VAR="ML_DESCRIPTION">[#RESUME]</LET>
<ELSEIF COND="[#INTRODUCTION]" />
<LET VAR="ML_DESCRIPTION">[#INTRODUCTION]</LET>
</IF>
<IF COND="[#ML_DESCRIPTION] AND [#ML_DESCRIPTION] LIKE /<r2r:ml lang=\"([a-z]+)\"/">
<LOOP NAME="foreach" ARRAY="[#MATCHES.1]">
<meta name="DC.description" xml:lang="[#VALUE]" lang="[#VALUE]" content="[#ML_DESCRIPTION:#VALUE|textebrut|cleanBadChars|replacequotationmark|trim]" />
</LOOP>
<ELSEIF COND="[#TEXTE]" />
<meta name="DC.description" xml:lang="[#LANGUE|defaultvalue([#MAINLANG])]" lang="[#LANGUE|defaultvalue([#MAINLANG])]" content="[#TEXTE|textebrut|cleanBadChars|replacequotationmark|cuttext(500, true)]" />
<ELSEIF COND="[#OPTIONS.METADONNEESSITE.DESCRIPTIONSITE]" />
<meta name="DC.description" xml:lang="[#LANGUE|defaultvalue([#MAINLANG])]" lang="[#LANGUE|defaultvalue([#MAINLANG])]" content="[#OPTIONS.METADONNEESSITE.DESCRIPTIONSITE|textebrut|cleanBadChars|replacequotationmark|trim]" />
</IF>
<IF COND="[#OPTIONS.METADONNEESSITE.EDITEUR]">
<meta name="DC.publisher" content="[#OPTIONS.METADONNEESSITE.EDITEUR|textebrut|cleanBadChars|replacequotationmark|trim]" />
</IF>
<IF COND="[#OPTIONS.METADONNEESSITE.DROITSAUTEUR]">
<meta name="DC.rights" content="[#OPTIONS.METADONNEESSITE.DROITSAUTEUR|textebrut|cleanBadChars|replacequotationmark|trim]" />
</IF>
<meta name="DC.source" content="[#SITEINFOS.URL]" />
<IF COND="[#CLASS] EQ 'publications'">
<meta name="DC.type" content="collection" />
<ELSEIF COND="[#CLASS] EQ 'textes'" />
<meta name="DC.type" content="journalArticle" />
</IF>
<meta name="DC.format" content="text/html" />
<meta name="DC.language" content="[%PAGELANG]" />
<meta name="DC.identifier" content="[#CURRENTURL_FIXED]" />
<IF COND="[#OPTIONS.METADONNEESSITE.ISSN_ELECTRONIQUE]">
<meta name="DC.identifier" content="urn:ISSN:[#OPTIONS.METADONNEESSITE.ISSN_ELECTRONIQUE|textebrut|cleanBadChars|replacequotationmark|trim]" />
</IF>
<FUNC NAME="HEAD_META_DOI" NAME_VALUE="DC.identifier" />
<IF COND="[#TITRE_COMPLET]">
<meta name="DC.title" content="[#TITRE_COMPLET]" />
</IF>
<FUNC NAME="HEAD_META_AUTHORS" NAME_VALUE="DC.creator" />
<FUNC NAME="HEAD_META_KEYWORDS" NAME_VALUE="DC.subject" />
<IF COND="[#DATEPUBLI|isadate] AND [#DATEPUBLI] NE '0000-00-00' AND [#DATEPUBLI] NE NULL">
<meta name="DC.date" content="[#DATEPUBLI]" />
<ELSEIF COND="[#DATEMISENLIGNE|isadate] AND [#DATEMISENLIGNE] NE '0000-00-00' AND [#DATEMISENLIGNE] NE NULL" />
<meta name="DC.date" content="[#DATEMISENLIGNE]" />
</IF>
</DEFMACRO>
/**
* Métadonnées Highwire Press (Google Scholar).
*/
<DEFMACRO NAME="HEAD_META_HWP">
<IF COND="[#TITRE_COMPLET]">
<meta name="citation_title" content="[#TITRE_COMPLET]" />
</IF>
<IF COND="[#PUBLICATION_DATE]">
<meta name="citation_publication_date" content="[#PUBLICATION_DATE|formateddate('%Y/%m/%d')]" />
</IF>
<IF COND="[#ONLINE_DATE]">
<meta name="citation_online_date" content="[#ONLINE_DATE|formateddate('%Y/%m/%d')]" />
</IF>
<FUNC NAME="HEAD_META_AUTHORS" NAME_VALUE="citation_author" />
<IF COND="[#PAGINATION]">
<LET ARRAY="pagination_part">[#PAGINATION|trim|lexplode('-')]</LET>
<meta name="citation_firstpage" content="[#PAGINATION_PART.0]" />
<IF COND="[#PAGINATION_PART.1]">
<meta name="citation_lastpage" content="[#PAGINATION_PART.1]" />
</IF>
</IF>
<IF COND="[#ALTERFICHIER]"/>
<meta name="citation_pdf_url" content="[#ID|makeurlwithid|query_string('file', '1')]" />
<ELSEIF COND="[#PDFGEN_URL] AND [#STATUS] GT 0"/>
<meta name="citation_pdf_url" content="[#PDFGEN_URL]" />
</IF>
<meta name="citation_journal_title" content="[#TITRESITE_COMPLET]" />
<IF COND="[#OPTIONS.METADONNEESSITE.ISSN_ELECTRONIQUE]" />
<meta name="citation_issn" content="[#OPTIONS.METADONNEESSITE.ISSN_ELECTRONIQUE]" />
</IF>
<!--[ Metadonnées du numéro ]-->
<LET VAR="idnumero">[#ID|getParentByType('numero')]</LET>
<LOOP NAME="head_meta_hwp_issue" TABLE="publications" WHERE="id = '[#ID]' OR id = '[#IDNUMERO]'" SELECT="numero, isbn">
<IF COND="[#NUMERO]">
<meta name="citation_issue" content="[#NUMERO]" />
</IF>
<IF COND="[#ISBN]">
<meta name="citation_isbn" content="[#ISBN]" />
</IF>
</LOOP>
<!--[ Les métadonnées qui suivent font partie des specs Highwire Press mais ne sont pas utilisées par Google Scholar.
https://scholar.google.com/intl/en/scholar/inclusion.html#indexing
https://www.monperrus.net/martin/accurate+bibliographic+metadata+and+google+scholar
]-->
<FUNC NAME="HEAD_META_DOI" NAME_VALUE="citation_doi" />
<meta name="citation_fulltext_html_url" content="[#CURRENTURL_FIXED]" />
<IF COND="[#OPTIONS.METADONNEESSITE.EDITEUR]">
<meta name="citation_publisher" content="[#OPTIONS.METADONNEESSITE.EDITEUR|textebrut|cleanBadChars|replacequotationmark|trim]" />
</IF>
<meta name="citation_language" content="[%PAGELANG]" />
<FUNC NAME="HEAD_META_KEYWORDS" NAME_VALUE="citation_keywords" />
</DEFMACRO>
/**
* Métadonnées OpenGraph.
*/
<DEFMACRO NAME="HEAD_META_OG">
<meta property="og:title" content="[%TITRE_PAGE|textebrut|cleanBadChars|replacequotationmark|trim]" />
<IF COND="[#CLASS] EQ 'textes'">
<meta property="og:type" content="article" />
<IF COND="[#PUBLICATION_DATE]">
<meta property="article:published_time" content="[#PUBLICATION_DATE]" />
</IF>
<IF COND="[#MODIFICATION_DATE]">
<meta property="article:modified_time" content="[#MODIFICATION_DATE]" />
</IF>
<FUNC NAME="HEAD_META_AUTHORS" NAME_KEY="property" NAME_VALUE="article:author" />
<FUNC NAME="HEAD_META_KEYWORDS" NAME_KEY="property" NAME_VALUE="article:tag" />
<ELSE/>
<meta property="og:type" content="website" />
</IF>
<LOOP NAME="head_meta_og_image" TABLE="fichiers" WHERE="type IN ('couverture1','imageaccroche') AND idparent = '[#ID]' AND (vignette !='' OR document !='')" ORDER="rank" LIMIT="1">
<IF COND="[#VIGNETTE]">
<meta property="og:image" content="[#SITEINFOS.URL]/[#VIGNETTE]" />
<ELSEIF COND="[#DOCUMENT]">
<meta property="og:image" content="[#SITEINFOS.URL]/[#DOCUMENT|vignette(500)]" />
</IF>
</LOOP>
<meta property="og:url" content="[#CURRENTURL_FIXED]" />
<LET VAR="meta_description"><MACRO NAME="BASE_META_DESCRIPTION" /></LET>
<IF COND="[#META_DESCRIPTION]">
<meta property="og:description" content="[#META_DESCRIPTION]" />
</IF>
<meta property="og:site_name" content="[#OPTIONS.METADONNEESSITE.TITRESITE|textebrut|cleanBadChars|replacequotationmark|trim]" />
</DEFMACRO>
/**
* Métadonnées Twitter.
*/
<DEFMACRO NAME="HEAD_META_TWITTER">
<meta name="twitter:card" content="summary" />
</DEFMACRO>
/**
* Affichage des metas auteurs.
* @param {string} name_value - Attribut name des balises meta.
* @param {string} [name_key] - Nom de l'attribut. Defaut : "name".
*/
<DEFFUNC NAME="HEAD_META_AUTHORS" REQUIRED="name_value" OPTIONAL="name_key" >
<IF COND="![#NAME_KEY]">
<LET VAR="name_key">name</LET>
</IF>
<LOOP NAME="head_meta_authors" TABLE="auteurs" WHERE="type='auteur'" WHERE="iddocument='[#ID]'" SELECT="prenom, nomfamille" ORDER="degree, rank">
<LET VAR="separator"><IF COND="[#PRENOM] AND [#NOMFAMILLE]">, </IF></LET>
<meta [#NAME_KEY]="[#NAME_VALUE]" content="[#NOMFAMILLE|textebrut|cleanBadChars|replacequotationmark|trim][#SEPARATOR][#PRENOM|textebrut|cleanBadChars|replacequotationmark|trim]" />
</LOOP>
</DEFFUNC>
/**
* Affichage des metas keywords.
* @param {string} name_value - Attribut name des balises meta.
* @param {string} [name_key] - Nom de l'attribut. Defaut : "name".
*/
<DEFFUNC NAME="HEAD_META_KEYWORDS" REQUIRED="name_value" OPTIONAL="name_key" >
<IF COND="![#NAME_KEY]">
<LET VAR="name_key">name</LET>
</IF>
<LOOP NAME="head_meta_keywords" TABLE="relations, entries" WHERE="id1 = '[#ID]' AND id2 = entries.id">
<meta [#NAME_KEY]="[#NAME_VALUE]" content="[#G_NAME|textebrut|cleanBadChars|replacequotationmark|trim]" />
</LOOP>
</DEFFUNC>
/**
* Affichage des metas doi en fonction des types d'entité mentionnés dans l'option show_doi_for_types.
* @param {string} name_value - Attribut name des balises meta.
*/
<DEFFUNC NAME="HEAD_META_DOI" REQUIRED="name_value" >
<IF COND="[%SHOW_DOI_FOR_TYPES] LIKE /([^,]+)/">
<LET VAR="showthistype"><LOOP NAME="foreach" ARRAY="[#MATCHES.1]"><IF COND="[#TYPE] EQ [#VALUE|trim]">1</IF></LOOP></LET>
</IF>
<IF COND="[%PREFIXEDOI] AND [#SHOWTHISTYPE] AND ![#PARAITRE]">
<meta name="[#NAME_VALUE]" content="doi:[%PREFIXEDOI][#ID]" />
</IF>
</DEFFUNC>
/**
* Insertion CSS.
*/
<DEFMACRO NAME="HEAD_INSERT_CSS">
<!--[ Bootstrap ]-->
<link href="[%DIR_VENDOR]/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<!--[ Largetable ]-->
<link href="[%DIR_VENDOR]/largetable/largetable.css" rel="stylesheet">
<!--[ Hook pour l'insertion de CSS ]-->
<MACRO NAME="HEAD_CUSTOM_CSS" />
<!--[ Site ]-->
<IF COND="[%DEV_MODE_ACTIVE]">
<!--[ Execution de LESS dans le navigateur pour le développement.
NE PAS UTILISER EN PRODUCTION ! ]-->
<link rel="stylesheet/less" type="text/css" href="tpl/less/site.less" />
<script>
window.devMode = true;
less = { env: "development", modifyVars: { webfontsDir: "../public/fonts", publicDir: "../public" } };
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/less.js/4.1.2/less.min.js"></script>
<ELSE />
<!--[ Mode normal : on sert les CSS précompilées. ]-->
<link rel="stylesheet" type="text/css" href="[%DIR_PUBLIC]/css/site.css" />
</IF>
</DEFMACRO>
/**
* Favicon.
*/
<DEFMACRO NAME="HEAD_INSERT_FAVICON">
<IF COND="[%FAVICON_DIR]">
<IF COND="[%FAVICON_DIR|substr(-1)] NE '/'">
<LET VAR="favicon_dir" GLOBAL="1">[%FAVICON_DIR]/</LET>
</IF>
<link rel="icon" href="[%FAVICON_DIR]favicon.ico" sizes="32x32">
<link rel="icon" href="[%FAVICON_DIR]icon.svg" type="image/svg+xml">
<link rel="apple-touch-icon" href="[%FAVICON_DIR]apple-touch-icon.png">
<link rel="manifest" href="[%FAVICON_DIR]manifest.webmanifest">
</IF>
</DEFMACRO>
/**
* Insertion Javascript.
*/
<DEFMACRO NAME="HEAD_INSERT_JS">
<!--[ jQuery ]-->
<script src="[%DIR_VENDOR]/jquery/jquery.slim.min.js"></script>
<!--[ Bootstrap ]-->
<script src="[%DIR_VENDOR]/bootstrap/js/bootstrap.bundle.min.js"></script>
<!--[ Largetable ]-->
<script src="[%DIR_VENDOR]/largetable/largetable.js"></script>
<!--[ Reframe ]-->
<script src="[%DIR_VENDOR]/reframe/reframe.min.js"></script>
<!--[ Dot-shortcuts ]-->
<IF COND="[%DOT_SHORTCUTS]">
<script>
window.activateDotShortcuts = "[%DOT_SHORTCUTS]";
</script>
</IF>
<!--[ Color contrast checker ]-->
<IF COND="[%CHECK_CONTRAST]">
<script src="[%DIR_VENDOR]/color-contrast-checker/jquery.color-contrast.js"></script>
<script src="tpl/public/js/check-contrast.js"></script>
</IF>
<!--[ Variables de traduction ]-->
<script>
window.translations = {
atteindreSection: "[@ATTEINDRE_SECTION]",
ecrireA: "[@ECRIRE_A]",
naviguerDansLArticle: "[@NAVIGUER_DANS_LARTICLE]",
menuPrincipalAfficher: "[@MENU_PRINCIPAL_AFFICHER]",
menuPrincipalMasquer: "[@MENU_PRINCIPAL_MASQUER]",
retourEnHaut: "[@RETOUR_EN_HAUT]"
};
</script>
<!--[ JS site ]-->
<script src="tpl/public/js/nova.js"></script>
<!--[ Hook pour l'insertion de JS ]-->
<MACRO NAME="HEAD_CUSTOM_JS" />
<!--[ Loader : lancer les fonctions ]-->
<MACRO NAME="HEAD_JS_LOADER" />
</DEFMACRO>
/**
* Chargement de la queue des fonctions JS.
*/
<DEFMACRO NAME="HEAD_JS_LOADER">
<script>
if (window.fnLoader) {
window.fnLoader.load();
} else {
console.error("fnLoader not found");
}
</script>
</DEFMACRO>
/**
* Insertion RSS.
*/
<DEFMACRO NAME="HEAD_INSERT_RSS">
<link rel="alternate" type="application/rss+xml" title="[#OPTIONS.METADONNEESSITE.TITRESITE|textebrut|cleanBadChars|replacequotationmark]" href="index.[#EXTENSIONSCRIPTS]?page=backend_rss" />
<link rel="alternate" type="application/rss+xml" title="[%TITRE_PAGE|trim()]" href="index.[#EXTENSIONSCRIPTS]?page=backend_rss&identity=[#ID]" />
</DEFMACRO>
/**
* Hook pour l'insertion de CSS dans le head, à redéclarer dans macros_custom.html.
*/
<DEFMACRO NAME="HEAD_CUSTOM_CSS">
</DEFMACRO>
/**
* Hook pour l'insertion de JS dans le head, à redéclarer dans macros_custom.html.
*/
<DEFMACRO NAME="HEAD_CUSTOM_JS">
</DEFMACRO>