Commit 49c5f4e9 authored by Alejandro Asensio's avatar Alejandro Asensio
Browse files

refactor(#16): avoid loading several times the datatables js/css bundles; load...

refactor(#16): avoid loading several times the datatables js/css bundles; load them only once in head.html and foot.html
parent 8f2ace54
......@@ -5,12 +5,4 @@ menu:
name: Genomics
weight: 1
type: genomics
# https://datatables.net/download/
css:
- https://cdn.datatables.net/v/bs4/jszip-2.5.0/dt-1.10.23/b-1.6.5/b-colvis-1.6.5/b-flash-1.6.5/b-html5-1.6.5/b-print-1.6.5/r-2.2.7/datatables.min.css
js:
- https://cdn.datatables.net/1.10.22/js/jquery.dataTables.js
- https://cdn.datatables.net/1.10.22/js/dataTables.bootstrap4.min.js
- https://cdn.datatables.net/v/bs4/jszip-2.5.0/dt-1.10.23/b-1.6.5/b-colvis-1.6.5/b-flash-1.6.5/b-html5-1.6.5/b-print-1.6.5/r-2.2.7/datatables.min.js
---
......@@ -5,14 +5,6 @@ menu:
name: Literature
weight: 3
type: literature
# https://datatables.net/download/
css:
- https://cdn.datatables.net/v/bs4/jszip-2.5.0/dt-1.10.23/b-1.6.5/b-colvis-1.6.5/b-flash-1.6.5/b-html5-1.6.5/b-print-1.6.5/r-2.2.7/datatables.min.css
js:
- https://cdn.datatables.net/1.10.22/js/jquery.dataTables.js
- https://cdn.datatables.net/1.10.22/js/dataTables.bootstrap4.min.js
- https://cdn.datatables.net/v/bs4/jszip-2.5.0/dt-1.10.23/b-1.6.5/b-colvis-1.6.5/b-flash-1.6.5/b-html5-1.6.5/b-print-1.6.5/r-2.2.7/datatables.min.js
---
This section presents a list of the latest published scientific journal articles and preprints on COVID-19 and SARS-CoV-2 where at least one author has a Spanish affiliation. You can filter out those publications with acknowledged funding to the "Fondo COVID19" funds. Note that the complete list contains the sum of various automatic searches that are daily fetched from [Europe PMC](https://europepmc.org/).
......
{{ define "main" }}
{{ if .Params.css }}
{{ range .Params.css }}
<link rel="stylesheet" href="{{ . }}">
{{end}}
{{ end }}
{{ if .Params.js }}
{{ range .Params.js }}
<script src="{{ . }}"></script>
{{end}}
{{ end }}
<div class="container">
<h1>{{ .Title }}</h1>
{{ .Content }}
......
......@@ -58,11 +58,7 @@
</div>
</main>
<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.22/js/jquery.dataTables.js"></script>
<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.22/js/dataTables.bootstrap4.min.js"></script>
<script>
$(function () {
$('.nav-pills a').on('click', function (e) {
e.preventDefault()
......
......@@ -187,18 +187,6 @@
</div>
</main>
{{ if .Params.css }}
{{ range .Params.css }}
<link rel="stylesheet" href="{{ . }}">
{{end}}
{{ end }}
{{ if .Params.js }}
{{ range .Params.js }}
<script src="{{ . }}"></script>
{{end}}
{{ end }}
<script>
$(document).ready(() => {
const table = $('#literature-table').DataTable({
......
<!-- jQuery first [moved to head.html], then Popper.js, then Bootstrap JS -->
<!-- Bootstrap: jQuery first [moved to head.html], then Popper.js, then Bootstrap JS -->
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-Piv4xVNRyMGpqkS2by6br4gNJ7DXjqk09RmUpJ8jgGtD7zP9yug3goQfGII0yAns" crossorigin="anonymous"></script>
<!-- DataTables with extended Bootstrap implementation and Buttons to export data https://datatables.net/download/ -->
<script src="https://cdn.datatables.net/1.10.22/js/jquery.dataTables.js"></script>
<script src="https://cdn.datatables.net/1.10.22/js/dataTables.bootstrap4.min.js"></script>
<script src="https://cdn.datatables.net/v/bs4/jszip-2.5.0/dt-1.10.23/b-1.6.5/b-colvis-1.6.5/b-flash-1.6.5/b-html5-1.6.5/b-print-1.6.5/r-2.2.7/datatables.min.js"></script>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-3SXPJ0G7T7"></script>
<script>
......
......@@ -2,8 +2,11 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Dynamic title -->
<title>{{ if ne .Page.Title "Home" }}{{ .Page.Title }} | {{ end }}{{ .Site.Title }}</title>
<meta name="description" content='{{ if .IsHome }}{{ .Param "description" }}{{ else }}{{ .Description }}{{ end }}'>
<!-- Multi-language support -->
{{ if .IsTranslated }}
{{ range .Translations }}
<link rel="alternate" hreflang="{{ .Language.Lang }}" href="{{ .RelPermalink }}" title="{{ .Language.LanguageName }}">
......@@ -29,16 +32,18 @@
<!-- Third party CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css" integrity="sha384-B0vP5xmATw1+K9KRQjQERJvTumQW0nPEzvF6L/Z6nronJ3oUOFUFpCjEUQouq2+l" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.22/css/dataTables.bootstrap4.min.css">
<link rel="stylesheet" href="/third_party/flowmaps-maps/flowmaps-maps.css">
<!-- DataTables https://datatables.net/download/ -->
<link rel="stylesheet" href="https://cdn.datatables.net/v/bs4/jszip-2.5.0/dt-1.10.23/b-1.6.5/b-colvis-1.6.5/b-flash-1.6.5/b-html5-1.6.5/b-print-1.6.5/r-2.2.7/datatables.min.css">
<!-- Own CSS using Hugo SASS pipeline -->
<!-- Compiled CSS using Hugo SASS pipeline -->
{{ $options := (dict "targetPath" "style.css" "enableSourceMap" true "includePaths" (slice "node_modules/myscss")) }}
{{ $style := resources.Get "sass/main.scss" | resources.ToCSS $options }}
<link rel="stylesheet" href="{{ $style.RelPermalink }}" integrity="{{ $style.Data.Integrity }}" media="screen">
<!-- Third party JS -->
<!-- Third party JS (needed before page rendering) -->
<script src="https://code.jquery.com/jquery-3.5.1.js" integrity="sha256-QWo7LDvxbWT2tbbQ97B53yJnYU3WhH/C8ycbRAkjPDc=" crossorigin="anonymous"></script>
<script src="/third_party/flowmaps-maps/flowmaps-maps.js"></script>
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
<script src="/third_party/flowmaps-maps/flowmaps-maps.js"></script>
</head>
......@@ -46,8 +46,6 @@
</tbody>
</table>
<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.22/js/jquery.dataTables.js"></script>
<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.22/js/dataTables.bootstrap4.min.js"></script>
<script>
$(function () {
......
......@@ -17,8 +17,6 @@
</tbody>
</table>
<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.22/js/jquery.dataTables.js"></script>
<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.22/js/dataTables.bootstrap4.min.js"></script>
<script>
$(document).ready(() => {
const covicatTable = $('#covicat-table').DataTable({
......
......@@ -167,6 +167,4 @@
});
});
</script>
<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.22/js/jquery.dataTables.js"></script>
<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.22/js/dataTables.bootstrap4.min.js"></script>
{{ end }}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment