Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved site load time #64

Merged
merged 1 commit into from
Jul 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions exampleSite/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ params:
# staticPath: "" # The path to serve the static files from
favicon: "/fav.png"

# Whether to serve bootstrap css and js files from CDN or not. Can be set to true, "css" or "js" to choose between
# serving both, only the css, or only the js files through the CDN. Any other value will make so that CDN is not used.
# Note the lack of "" in true, it should be of boolean type.
useBootstrapCDN: false

theme:
disableThemeToggle: false
# defaultTheme: "light" # dark
Expand Down
8 changes: 7 additions & 1 deletion layouts/_default/baseof.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,19 @@
<body class="light" onload="loading()">
<!-- javascripts -->
<!-- <script src="/js/jquery-3.6.0.min.js"></script> -->
<script src="{{ .Site.Params.staticPath }}/bootstrap-5/js/bootstrap.bundle.js"></script>

{{- partial "sections/header.html" . -}}
<div id="content">
{{- block "main" . }}{{- end }}
</div>
{{- partial "sections/footer/index.html" . -}}

{{- if (or (eq .Site.Params.UseBootstrapCDN true) (eq .Site.Params.UseBootstrapCDN "js")) -}}
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.min.js" integrity="sha384-QJHtvGhmr9XOIpI6YVutG+2QOK9T+ZnN4kzFN1RtK3zEFEIsxhlmWl5/YESvpZ13" crossorigin="anonymous"></script>
{{- else -}}
<script src="{{ .Site.Params.staticPath }}/bootstrap-5/js/bootstrap.bundle.min.js"></script>
{{- end -}}

{{- partial "scripts.html" . -}}
</body>

Expand Down
19 changes: 16 additions & 3 deletions layouts/partials/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,18 @@
<!-- Fonts -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link
href="https://fonts.googleapis.com/css2?family=Alata&family=Lora:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600;1,700&family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap"
rel="stylesheet">
<link rel="preload"
as="style"
href="https://fonts.googleapis.com/css2?family=Alata&family=Lora:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600;1,700&family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap"
>
<link rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Alata&family=Lora:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600;1,700&family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap"
media="print" onload="this.media='all'" />
<noscript>
<link
href="https://fonts.googleapis.com/css2?family=Alata&family=Lora:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600;1,700&family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap"
rel="stylesheet">
</noscript>

<!-- font configuration -->
<link rel="stylesheet" href="{{ .Site.Params.staticPath }}/css/font.css" media="all">
Expand All @@ -19,7 +28,11 @@
{{ template "_internal/twitter_cards.html" . }}

<!-- stylesheets -->
{{- if (or (eq .Site.Params.UseBootstrapCDN true) (eq .Site.Params.UseBootstrapCDN "css")) -}}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
{{- else -}}
<link rel="stylesheet" href="{{ .Site.Params.staticPath }}/bootstrap-5/css/bootstrap.min.css" media="all">
{{- end -}}
<link rel="stylesheet" href="{{ .Site.Params.staticPath }}/css/header.css" media="all">
<link rel="stylesheet" href="{{ .Site.Params.staticPath }}/css/footer.css" media="all">

Expand Down
7 changes: 7 additions & 0 deletions static/bootstrap-5/js/bootstrap.bundle.min.js

Large diffs are not rendered by default.