Переглянути джерело

feat: migrate to latest web best practices

Informed by Google Lighthouse insights.

The demo of the light Academic template now achieves 100% Accessibility, 100% Best Practices, and 100% SEO scores.

Hero image can now be moved from the media library to the widget page folder, e.g. `home/`, to become responsively sized.
George Cushen 4 роки тому
батько
коміт
4b9ee3021c

+ 2 - 2
wowchemy/assets/scss/wowchemy/_callouts.scss

@@ -30,7 +30,7 @@ div.alert > div:first-child::before {
   top: -0.5rem;
   top: -0.5rem;
   left: -2rem;
   left: -2rem;
   font-size: 1.5rem;
   font-size: 1.5rem;
-  color: #209cee;
+  color: #1976d2;
   font-family: 'Font Awesome 5 Free';
   font-family: 'Font Awesome 5 Free';
   font-weight: 900;
   font-weight: 900;
   content: '\f05a';
   content: '\f05a';
@@ -56,7 +56,7 @@ div.alert a {
 .alert-note {
 .alert-note {
   color: #12537e;
   color: #12537e;
   background-color: #f6fbfe;
   background-color: #f6fbfe;
-  border-color: #209cee;
+  border-color: #1976d2;
 }
 }
 
 
 .alert-warning {
 .alert-warning {

+ 3 - 3
wowchemy/assets/scss/wowchemy/_card.scss

@@ -46,19 +46,19 @@ a.summary-link {
   min-height: 100px;
   min-height: 100px;
 }
 }
 
 
-.card h4 {
+.card .section-subheading {
   font-size: 0.9rem;
   font-size: 0.9rem;
   font-weight: 700;
   font-weight: 700;
   line-height: 1.5;
   line-height: 1.5;
   text-transform: uppercase;
   text-transform: uppercase;
 }
 }
 
 
-.card h4 a {
+.card .section-subheading a {
   color: #000;
   color: #000;
   border-bottom: solid 1px transparent;
   border-bottom: solid 1px transparent;
 }
 }
 
 
-.card h4 a:hover {
+.card .section-subheading a:hover {
   color: #000;
   color: #000;
   border-bottom: solid 1px #000;
   border-bottom: solid 1px #000;
   text-decoration: none;
   text-decoration: none;

+ 1 - 1
wowchemy/assets/scss/wowchemy/_dark.scss

@@ -100,7 +100,7 @@ body.dark,
   background: #343a40;
   background: #343a40;
 }
 }
 
 
-.dark .card h4 a {
+.dark .card .section-subheading a {
   color: $sta-primary;
   color: $sta-primary;
   border-bottom: solid 1px transparent;
   border-bottom: solid 1px transparent;
 }
 }

+ 17 - 2
wowchemy/assets/scss/wowchemy/_root.scss

@@ -336,6 +336,10 @@ small,
   background: $sta-background;
   background: $sta-background;
 }
 }
 
 
+.dark .modal-content {
+  background: $sta-dark-background;
+}
+
 .modal-title {
 .modal-title {
   margin: 0; /* Override default h5 margin. */
   margin: 0; /* Override default h5 margin. */
 }
 }
@@ -366,6 +370,12 @@ small,
   font-size: 0;
   font-size: 0;
 }
 }
 
 
+.gallery img {
+  // Satisfy Lighthouse criteria even if a lazy image hasn't loaded yet.
+  min-height: 48px;
+  min-width: 48px;
+}
+
 a[data-fancybox] {
 a[data-fancybox] {
   text-decoration: none;
   text-decoration: none;
   cursor: zoom-in;
   cursor: zoom-in;
@@ -453,7 +463,7 @@ a.badge:hover {
 .tag-cloud a {
 .tag-cloud a {
   display: inline-block;
   display: inline-block;
   position: relative;
   position: relative;
-  margin: 5px 10px;
+  margin: 8px 10px;
   word-wrap: break-word;
   word-wrap: break-word;
   transition-duration: .2s;
   transition-duration: .2s;
   transition-property: transform;
   transition-property: transform;
@@ -491,10 +501,15 @@ a.badge:hover {
 
 
 .btn.btn-sm {
 .btn.btn-sm {
   padding: 5px .4rem 5px .4rem;
   padding: 5px .4rem 5px .4rem;
-  font-size: .6rem;
+  font-size: 14px;
   border-radius: .2rem;
   border-radius: .2rem;
 }
 }
 
 
+.btn-page-header {
+  // Satisfy Lighthouse tap targets criteria.
+  margin: 8px 8px 8px 0;
+}
+
 /*************************************************
 /*************************************************
  *  Toolbar Buttons
  *  Toolbar Buttons
  **************************************************/
  **************************************************/

+ 32 - 2
wowchemy/assets/scss/wowchemy/_widgets.scss

@@ -23,6 +23,21 @@
   min-height: 100vh;
   min-height: 100vh;
 }
 }
 
 
+// Section theming
+
+.home-section.light,
+.home-section.light h1 {
+  color: #000;
+}
+
+.home-section.light a {
+  color: $sta-link;
+}
+
+.home-section.dark a {
+  color: $sta-dark-link;
+}
+
 /* Override dark colors that may be inherited from body.dark */
 /* Override dark colors that may be inherited from body.dark */
 .home-section.dark,
 .home-section.dark,
 .home-section.dark h1,
 .home-section.dark h1,
@@ -117,6 +132,14 @@
   margin: 0 0 10px 0;
   margin: 0 0 10px 0;
 }
 }
 
 
+.section-subheading {
+  font-size: 1.25rem;
+  font-family: $sta-font-heading, sans-serif;
+  font-weight: bold;
+  margin-top: 1rem;
+  margin-bottom: .5rem;
+}
+
 .section-heading p {
 .section-heading p {
   font-weight: 400;
   font-weight: 400;
   font-size: 1.1rem;
   font-size: 1.1rem;
@@ -248,7 +271,7 @@ a.hero-cta-alt:hover {
   text-align: center;
   text-align: center;
 }
 }
 
 
-.featurette h3 {
+.featurette .section-subheading {
   margin-top: 0;
   margin-top: 0;
   margin-bottom: 5px;
   margin-bottom: 5px;
   font-weight: 400;
   font-weight: 400;
@@ -256,7 +279,7 @@ a.hero-cta-alt:hover {
 }
 }
 
 
 .dark .featurette,
 .dark .featurette,
-.dark .featurette h3 {
+.dark .featurette .section-subheading {
   color: #fff;
   color: #fff;
 }
 }
 
 
@@ -586,3 +609,10 @@ ul.ul-edu li .description p.institution {
   height: 350px;
   height: 350px;
   width: 100%;
   width: 100%;
 }
 }
+
+// Prevent OpenStreetMap inheriting link color from section of a different theme variation.
+// E.g. Light colored OpenStreetMap UI inheriting dark themed link (`.home-section.dark a`)
+// from a dark widget page section.
+#map a {
+  color: initial;
+}

+ 1 - 1
wowchemy/data/fonts/minimal.toml

@@ -2,7 +2,7 @@
 name = "Minimal"
 name = "Minimal"
 
 
 # Optional Google font URL
 # Optional Google font URL
-google_fonts = "Montserrat:400,700|Roboto:400,400italic,700|Roboto+Mono"
+google_fonts = "family=Montserrat:wght@400;700&family=Roboto+Mono&family=Roboto:wght@400;700"
 
 
 # Font families
 # Font families
 heading_font = "Montserrat"
 heading_font = "Montserrat"

+ 5 - 1
wowchemy/data/themes/minimal.toml

@@ -5,7 +5,7 @@ name = "Minimal"
 light = true
 light = true
 
 
 # Primary
 # Primary
-primary = "#2962ff"
+primary = "#1565c0"
 
 
 # Menu
 # Menu
 menu_primary = "#fff"
 menu_primary = "#fff"
@@ -16,3 +16,7 @@ menu_title = "#2b2b2b"
 # Home sections
 # Home sections
 home_section_odd = "rgb(255, 255, 255)"
 home_section_odd = "rgb(255, 255, 255)"
 home_section_even = "rgb(247, 247, 247)"
 home_section_even = "rgb(247, 247, 247)"
+
+[dark]
+  link = "#bbdefb"
+  link_hover = "#bbdefb"

+ 3 - 0
wowchemy/i18n/en.yaml

@@ -15,6 +15,9 @@
 - id: home
 - id: home
   translation: Home
   translation: Home
 
 
+- id: close
+  translation: Close
+
 # General
 # General
 
 
 - id: related
 - id: related

+ 2 - 2
wowchemy/layouts/partials/li_card.html

@@ -51,9 +51,9 @@
   </a>
   </a>
   {{end}}
   {{end}}
 
 
-  <h3 class="article-title mb-1 mt-3">
+  <div class="section-subheading article-title mb-1 mt-3">
     <a href="{{ $item.RelPermalink }}">{{ $item.Title }}</a>
     <a href="{{ $item.RelPermalink }}">{{ $item.Title }}</a>
-  </h3>
+  </div>
 
 
   {{ with $summary }}
   {{ with $summary }}
   <a href="{{ $item.RelPermalink }}" class="summary-link">
   <a href="{{ $item.RelPermalink }}" class="summary-link">

+ 2 - 2
wowchemy/layouts/partials/li_compact.html

@@ -33,9 +33,9 @@
 <div class="media stream-item">
 <div class="media stream-item">
   <div class="media-body">
   <div class="media-body">
 
 
-    <h3 class="article-title mb-0 mt-0">
+    <div class="section-subheading article-title mb-0 mt-0">
       <a href="{{$link}}" {{ $target | safeHTMLAttr }}>{{ $item.Title }}</a>
       <a href="{{$link}}" {{ $target | safeHTMLAttr }}>{{ $item.Title }}</a>
-    </h3>
+    </div>
 
 
     {{ with $summary }}
     {{ with $summary }}
     <a href="{{ $link }}" {{ $target | safeHTMLAttr }} class="summary-link">
     <a href="{{ $link }}" {{ $target | safeHTMLAttr }} class="summary-link">

+ 15 - 15
wowchemy/layouts/partials/page_links.html

@@ -10,7 +10,7 @@
   {{ else }}
   {{ else }}
     {{ $link = . | relURL }}
     {{ $link = . | relURL }}
   {{ end }}
   {{ end }}
-<a class="btn btn-outline-primary my-1 mr-1{{ if $is_list }} btn-sm{{end}}" href="{{ $link }}" target="_blank" rel="noopener">
+<a class="btn btn-outline-primary btn-page-header{{ if $is_list }} btn-sm{{end}}" href="{{ $link }}" target="_blank" rel="noopener">
   {{ i18n "btn_preprint" }}
   {{ i18n "btn_preprint" }}
 </a>
 </a>
 {{ end }}
 {{ end }}
@@ -25,16 +25,16 @@
 {{ end }}
 {{ end }}
 
 
 {{ with $pdf }}
 {{ with $pdf }}
-<a class="btn btn-outline-primary my-1 mr-1{{ if $is_list }} btn-sm{{end}}" href="{{ . }}" target="_blank" rel="noopener">
+<a class="btn btn-outline-primary btn-page-header{{ if $is_list }} btn-sm{{end}}" href="{{ . }}" target="_blank" rel="noopener">
   {{ i18n "btn_pdf" }}
   {{ i18n "btn_pdf" }}
 </a>
 </a>
 {{ end }}
 {{ end }}
 {{ $resource := $page.Resources.GetMatch "cite.bib" }}
 {{ $resource := $page.Resources.GetMatch "cite.bib" }}
 {{ with $resource }}
 {{ with $resource }}
-<button type="button" class="btn btn-outline-primary my-1 mr-1{{ if $is_list }} btn-sm{{end}} js-cite-modal"
+<a href="#" class="btn btn-outline-primary btn-page-header{{ if $is_list }} btn-sm{{end}} js-cite-modal"
         data-filename="{{ .RelPermalink }}">
         data-filename="{{ .RelPermalink }}">
   {{ i18n "btn_cite" }}
   {{ i18n "btn_cite" }}
-</button>
+</a>
 {{ end }}
 {{ end }}
 {{ with $page.Params.url_code }}
 {{ with $page.Params.url_code }}
   {{ $resource := $page.Resources.GetMatch . }}
   {{ $resource := $page.Resources.GetMatch . }}
@@ -43,7 +43,7 @@
   {{ else }}
   {{ else }}
     {{ $link = . | relURL }}
     {{ $link = . | relURL }}
   {{ end }}
   {{ end }}
-<a class="btn btn-outline-primary my-1 mr-1{{ if $is_list }} btn-sm{{end}}" href="{{ $link }}" target="_blank" rel="noopener">
+<a class="btn btn-outline-primary btn-page-header{{ if $is_list }} btn-sm{{end}}" href="{{ $link }}" target="_blank" rel="noopener">
   {{ i18n "btn_code" }}
   {{ i18n "btn_code" }}
 </a>
 </a>
 {{ end }}
 {{ end }}
@@ -54,14 +54,14 @@
   {{ else }}
   {{ else }}
     {{ $link = . | relURL }}
     {{ $link = . | relURL }}
   {{ end }}
   {{ end }}
-<a class="btn btn-outline-primary my-1 mr-1{{ if $is_list }} btn-sm{{end}}" href="{{ $link }}" target="_blank" rel="noopener">
+<a class="btn btn-outline-primary btn-page-header{{ if $is_list }} btn-sm{{end}}" href="{{ $link }}" target="_blank" rel="noopener">
   {{ i18n "btn_dataset" }}
   {{ i18n "btn_dataset" }}
 </a>
 </a>
 {{ end }}
 {{ end }}
 {{ if $page.Params.projects }}
 {{ if $page.Params.projects }}
 {{ range $page.Params.projects }}
 {{ range $page.Params.projects }}
   {{ with (site.GetPage (printf "project/%s" .)) }}
   {{ with (site.GetPage (printf "project/%s" .)) }}
-  <a class="btn btn-outline-primary my-1 mr-1{{ if $is_list }} btn-sm{{end}}" href="{{ .RelPermalink }}">
+  <a class="btn btn-outline-primary btn-page-header{{ if $is_list }} btn-sm{{end}}" href="{{ .RelPermalink }}">
     {{ i18n "btn_project" }}
     {{ i18n "btn_project" }}
   </a>
   </a>
   {{ else }}
   {{ else }}
@@ -70,7 +70,7 @@
 {{ end }}
 {{ end }}
 {{ else }}
 {{ else }}
 {{ with $page.Params.url_project }}
 {{ with $page.Params.url_project }}
-<a class="btn btn-outline-primary my-1 mr-1{{ if $is_list }} btn-sm{{end}}" href="{{ . }}" target="_blank" rel="noopener">
+<a class="btn btn-outline-primary btn-page-header{{ if $is_list }} btn-sm{{end}}" href="{{ . }}" target="_blank" rel="noopener">
   {{ i18n "btn_project" }}
   {{ i18n "btn_project" }}
 </a>
 </a>
 {{ end }}
 {{ end }}
@@ -82,13 +82,13 @@
   {{ else }}
   {{ else }}
     {{ $link = . | relURL }}
     {{ $link = . | relURL }}
   {{ end }}
   {{ end }}
-<a class="btn btn-outline-primary my-1 mr-1{{ if $is_list }} btn-sm{{end}}" href="{{ $link }}" target="_blank" rel="noopener">
+<a class="btn btn-outline-primary btn-page-header{{ if $is_list }} btn-sm{{end}}" href="{{ $link }}" target="_blank" rel="noopener">
   {{ i18n "btn_poster" }}
   {{ i18n "btn_poster" }}
 </a>
 </a>
 {{ end }}
 {{ end }}
 {{ if $page.Params.slides }}
 {{ if $page.Params.slides }}
   {{ with (site.GetPage (printf "slides/%s" $page.Params.slides)) }}
   {{ with (site.GetPage (printf "slides/%s" $page.Params.slides)) }}
-  <a class="btn btn-outline-primary my-1 mr-1{{ if $is_list }} btn-sm{{end}}" href="{{ .RelPermalink }}" target="_blank">
+  <a class="btn btn-outline-primary btn-page-header{{ if $is_list }} btn-sm{{end}}" href="{{ .RelPermalink }}" target="_blank">
     {{ i18n "btn_slides" }}
     {{ i18n "btn_slides" }}
   </a>
   </a>
   {{ end }}
   {{ end }}
@@ -100,7 +100,7 @@
   {{ else }}
   {{ else }}
     {{ $link = . | relURL }}
     {{ $link = . | relURL }}
   {{ end }}
   {{ end }}
-<a class="btn btn-outline-primary my-1 mr-1{{ if $is_list }} btn-sm{{end}}" href="{{ $link }}" target="_blank" rel="noopener">
+<a class="btn btn-outline-primary btn-page-header{{ if $is_list }} btn-sm{{end}}" href="{{ $link }}" target="_blank" rel="noopener">
   {{ i18n "btn_slides" }}
   {{ i18n "btn_slides" }}
 </a>
 </a>
 {{ end }}
 {{ end }}
@@ -112,7 +112,7 @@
   {{ else }}
   {{ else }}
     {{ $link = . | relURL }}
     {{ $link = . | relURL }}
   {{ end }}
   {{ end }}
-<a class="btn btn-outline-primary my-1 mr-1{{ if $is_list }} btn-sm{{end}}" href="{{ $link }}" target="_blank" rel="noopener">
+<a class="btn btn-outline-primary btn-page-header{{ if $is_list }} btn-sm{{end}}" href="{{ $link }}" target="_blank" rel="noopener">
   {{ i18n "btn_video" }}
   {{ i18n "btn_video" }}
 </a>
 </a>
 {{ end }}
 {{ end }}
@@ -123,12 +123,12 @@
   {{ else }}
   {{ else }}
     {{ $link = . | relURL }}
     {{ $link = . | relURL }}
   {{ end }}
   {{ end }}
-<a class="btn btn-outline-primary my-1 mr-1{{ if $is_list }} btn-sm{{end}}" href="{{ $link }}" target="_blank" rel="noopener">
+<a class="btn btn-outline-primary btn-page-header{{ if $is_list }} btn-sm{{end}}" href="{{ $link }}" target="_blank" rel="noopener">
   {{ i18n "btn_source" }}
   {{ i18n "btn_source" }}
 </a>
 </a>
 {{ end }}
 {{ end }}
 {{ with $page.Params.doi }}
 {{ with $page.Params.doi }}
-<a class="btn btn-outline-primary my-1 mr-1{{ if $is_list }} btn-sm{{end}}" href="https://doi.org/{{ . }}" target="_blank" rel="noopener">
+<a class="btn btn-outline-primary btn-page-header{{ if $is_list }} btn-sm{{end}}" href="https://doi.org/{{ . }}" target="_blank" rel="noopener">
   DOI
   DOI
 </a>
 </a>
 {{ end }}
 {{ end }}
@@ -151,7 +151,7 @@
   {{ else if in (slice "http" "https") $scheme }}
   {{ else if in (slice "http" "https") $scheme }}
     {{ $target = "target=\"_blank\" rel=\"noopener\"" }}
     {{ $target = "target=\"_blank\" rel=\"noopener\"" }}
   {{ end }}
   {{ end }}
-  <a class="btn btn-outline-primary my-1 mr-1{{ if $is_list }} btn-sm{{end}}" href="{{ $link | safeURL }}" {{ $target | safeHTMLAttr }}>
+  <a class="btn btn-outline-primary btn-page-header{{ if $is_list }} btn-sm{{end}}" href="{{ $link | safeURL }}" {{ $target | safeHTMLAttr }}>
     {{ if .icon }}<i class="{{ $pack }} {{ $pack_prefix }}-{{ .icon }} {{if .name}}mr-1{{end}}"></i>{{end}}
     {{ if .icon }}<i class="{{ $pack }} {{ $pack_prefix }}-{{ .icon }} {{if .name}}mr-1{{end}}"></i>{{end}}
     {{ with .name }}{{ . | safeHTML }}{{end}}
     {{ with .name }}{{ . | safeHTML }}{{end}}
   </a>
   </a>

+ 3 - 2
wowchemy/layouts/partials/search.html

@@ -9,14 +9,15 @@
           <h1>{{ i18n "search" }}</h1>
           <h1>{{ i18n "search" }}</h1>
         </div>
         </div>
         <div class="col-6 col-search-close">
         <div class="col-6 col-search-close">
-          <a class="js-search" href="#"><i class="fas fa-times-circle text-muted" aria-hidden="true"></i></a>
+          <a class="js-search" href="#" aria-label="{{i18n "close" | default "Close"}}"><i class="fas fa-times-circle text-muted" aria-hidden="true"></i></a>
         </div>
         </div>
       </div>
       </div>
 
 
       <div id="search-box">
       <div id="search-box">
         {{ if eq site.Params.search.engine 1 }}
         {{ if eq site.Params.search.engine 1 }}
         <input name="q" id="search-query" placeholder="{{i18n "search_placeholder"}}" autocapitalize="off"
         <input name="q" id="search-query" placeholder="{{i18n "search_placeholder"}}" autocapitalize="off"
-        autocomplete="off" autocorrect="off" spellcheck="false" type="search" class="form-control">
+        autocomplete="off" autocorrect="off" spellcheck="false" type="search" class="form-control"
+        aria-label="{{i18n "search_placeholder"}}">
         {{ else }}
         {{ else }}
         <!-- Search box will appear here -->
         <!-- Search box will appear here -->
         {{ end }}
         {{ end }}

+ 11 - 9
wowchemy/layouts/partials/site_head.html

@@ -78,7 +78,7 @@
       {{ printf "<link rel=\"stylesheet\" href=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\">" (printf $css.academicons.url $css.academicons.version) $css.academicons.sri | safeHTML }}
       {{ printf "<link rel=\"stylesheet\" href=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\">" (printf $css.academicons.url $css.academicons.version) $css.academicons.sri | safeHTML }}
     {{ end }}
     {{ end }}
     {{ printf "<link rel=\"stylesheet\" href=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\">" (printf $css.fontAwesome.url $css.fontAwesome.version) $css.fontAwesome.sri | safeHTML }}
     {{ printf "<link rel=\"stylesheet\" href=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\">" (printf $css.fontAwesome.url $css.fontAwesome.version) $css.fontAwesome.sri | safeHTML }}
-    {{ printf "<link rel=\"stylesheet\" href=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\">" (printf $css.fancybox.url $css.fancybox.version) $css.fancybox.sri | safeHTML }}
+    {{ printf "<link rel=\"stylesheet\" href=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\" media=\"print\" onload=\"this.media='all'\">" (printf $css.fancybox.url $css.fancybox.version) $css.fancybox.sri | safeHTML }}
 
 
     {{/* Default to disabling highlighting, but allow the user to override it in .Params or site.Params.
     {{/* Default to disabling highlighting, but allow the user to override it in .Params or site.Params.
          Use $scr to store "highlight_enabled", so that we can read it again in footer.html. */}}
          Use $scr to store "highlight_enabled", so that we can read it again in footer.html. */}}
@@ -91,21 +91,21 @@
     {{ if ($scr.Get "highlight_enabled") }}
     {{ if ($scr.Get "highlight_enabled") }}
       {{ $v := $css.highlight.version }}
       {{ $v := $css.highlight.version }}
       {{ with site.Params.highlight_style }}
       {{ with site.Params.highlight_style }}
-        {{ printf "<link rel=\"stylesheet\" href=\"%s\" crossorigin=\"anonymous\" title=\"hl-light\">" (printf $css.highlight.url $css.highlight.version .) | safeHTML }}
-        {{ printf "<link rel=\"stylesheet\" href=\"%s\" crossorigin=\"anonymous\" title=\"hl-dark\" disabled>" (printf $css.highlight.url $css.highlight.version .) | safeHTML }}
+        {{ printf "<link rel=\"stylesheet\" href=\"%s\" crossorigin=\"anonymous\" title=\"hl-light\" media=\"print\" onload=\"this.media='all'\">" (printf $css.highlight.url $css.highlight.version .) | safeHTML }}
+        {{ printf "<link rel=\"stylesheet\" href=\"%s\" crossorigin=\"anonymous\" title=\"hl-dark\" media=\"print\" onload=\"this.media='all'\" disabled>" (printf $css.highlight.url $css.highlight.version .) | safeHTML }}
       {{ else }}
       {{ else }}
         {{ if eq ($scr.Get "light") true }}
         {{ if eq ($scr.Get "light") true }}
-          {{ printf "<link rel=\"stylesheet\" href=\"%s\" crossorigin=\"anonymous\" title=\"hl-light\">" (printf $css.highlight.url $css.highlight.version "github") | safeHTML }}
-          {{ printf "<link rel=\"stylesheet\" href=\"%s\" crossorigin=\"anonymous\" title=\"hl-dark\" disabled>" (printf $css.highlight.url $css.highlight.version "dracula") | safeHTML }}
+          {{ printf "<link rel=\"stylesheet\" href=\"%s\" crossorigin=\"anonymous\" title=\"hl-light\" media=\"print\" onload=\"this.media='all'\">" (printf $css.highlight.url $css.highlight.version "github") | safeHTML }}
+          {{ printf "<link rel=\"stylesheet\" href=\"%s\" crossorigin=\"anonymous\" title=\"hl-dark\" media=\"print\" onload=\"this.media='all'\" disabled>" (printf $css.highlight.url $css.highlight.version "dracula") | safeHTML }}
         {{ else }}
         {{ else }}
-          {{ printf "<link rel=\"stylesheet\" href=\"%s\" crossorigin=\"anonymous\" title=\"hl-light\" disabled>" (printf $css.highlight.url $css.highlight.version "github") | safeHTML }}
-          {{ printf "<link rel=\"stylesheet\" href=\"%s\" crossorigin=\"anonymous\" title=\"hl-dark\">" (printf $css.highlight.url $css.highlight.version "dracula") | safeHTML }}
+          {{ printf "<link rel=\"stylesheet\" href=\"%s\" crossorigin=\"anonymous\" title=\"hl-light\" media=\"print\" onload=\"this.media='all'\" disabled>" (printf $css.highlight.url $css.highlight.version "github") | safeHTML }}
+          {{ printf "<link rel=\"stylesheet\" href=\"%s\" crossorigin=\"anonymous\" title=\"hl-dark\" media=\"print\" onload=\"this.media='all'\">" (printf $css.highlight.url $css.highlight.version "dracula") | safeHTML }}
         {{ end }}
         {{ end }}
       {{ end }}
       {{ end }}
     {{ end }}
     {{ end }}
 
 
     {{ if or (eq site.Params.map.engine 2) (eq site.Params.map.engine 3) }}
     {{ if or (eq site.Params.map.engine 2) (eq site.Params.map.engine 3) }}
-    {{ printf "<link rel=\"stylesheet\" href=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\">" (printf $css.leaflet.url $css.leaflet.version) $css.leaflet.sri | safeHTML }}
+    {{ printf "<link rel=\"stylesheet\" href=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\" media=\"print\" onload=\"this.media='all'\">" (printf $css.leaflet.url $css.leaflet.version) $css.leaflet.sri | safeHTML }}
     {{ end }}
     {{ end }}
 
 
     {{ if eq site.Params.search.engine 2 }}
     {{ if eq site.Params.search.engine 2 }}
@@ -134,11 +134,13 @@
   {{ with ($scr.Get "google_fonts") }}
   {{ with ($scr.Get "google_fonts") }}
     {{ if hasPrefix . "family=" }}
     {{ if hasPrefix . "family=" }}
       {{/* If `google_fonts` starts with "family=", use API v2 (https://developers.google.com/fonts/docs/css2) */}}
       {{/* If `google_fonts` starts with "family=", use API v2 (https://developers.google.com/fonts/docs/css2) */}}
-      <link rel="stylesheet" {{ printf "href=\"https://fonts.googleapis.com/css2?%s&display=swap\"" . | safeHTMLAttr }}>
+      <link rel="preload" as="style" {{ printf "href=\"https://fonts.googleapis.com/css2?%s&display=swap\"" . | safeHTMLAttr }}>
+      <link rel="stylesheet" {{ printf "href=\"https://fonts.googleapis.com/css2?%s&display=swap\"" . | safeHTMLAttr }} media="print" onload="this.media='all'">
     {{ else }}
     {{ else }}
       {{/* Otherwise, use API v1 */}}
       {{/* Otherwise, use API v1 */}}
       {{/* Hugo's htmlEscape cannot escape "|" in Google Font URIs so we implement our own escape functionality. */}}
       {{/* Hugo's htmlEscape cannot escape "|" in Google Font URIs so we implement our own escape functionality. */}}
       <link rel="stylesheet" {{ printf "href=\"https://fonts.googleapis.com/css?family=%s&display=swap\"" . | replaceRE "\\|" "%7C" | safeHTMLAttr }}>
       <link rel="stylesheet" {{ printf "href=\"https://fonts.googleapis.com/css?family=%s&display=swap\"" . | replaceRE "\\|" "%7C" | safeHTMLAttr }}>
+      {{ warnf "There is a new version of Google Fonts. Learn how to upgrade your font pack at https://wowchemy.com/docs/customization/#custom-font" }}
     {{ end }}
     {{ end }}
   {{ end }}
   {{ end }}
 
 

+ 6 - 6
wowchemy/layouts/partials/widget_page.html

@@ -39,13 +39,9 @@
   {{ end }}
   {{ end }}
 
 
   {{ if $bg.image }}
   {{ if $bg.image }}
-    {{ $darken := "" }}
-    {{ if $bg.image_darken }}
-      {{ $darken = printf "linear-gradient(rgba(0, 0, 0, %s), rgba(0, 0, 0, %s))," (string $bg.image_darken) (string $bg.image_darken) }}
-    {{ end }}
     {{/* See Hugo note on linking assets in styles: https://github.com/gohugoio/hugoThemes#common-permalink-issues */}}
     {{/* See Hugo note on linking assets in styles: https://github.com/gohugoio/hugoThemes#common-permalink-issues */}}
     {{ $media_dir := $.Scratch.Get "media_dir" }}
     {{ $media_dir := $.Scratch.Get "media_dir" }}
-    {{ $style_bg = printf "%sbackground-image: %s url('%s');" $style_bg $darken (printf "%s/%s" $media_dir $bg.image | absURL) }}
+    {{ $style_bg = printf "%sbackground-image: url('%s');" $style_bg (printf "%s/%s" $media_dir $bg.image | absURL) }}
     {{ with $bg.image_size }}
     {{ with $bg.image_size }}
       {{/* Allow sizes: actual, cover, and contain. */}}
       {{/* Allow sizes: actual, cover, and contain. */}}
       {{ $style_bg = printf "%sbackground-size: %s;" $style_bg (replace . "actual" "auto") }}
       {{ $style_bg = printf "%sbackground-size: %s;" $style_bg (replace . "actual" "auto") }}
@@ -56,6 +52,10 @@
     {{ end }}
     {{ end }}
   {{ end }}
   {{ end }}
 
 
+  {{ if $bg.image_darken }}
+    {{ $style_bg = printf "%sfilter: brightness(%s);" $style_bg (string $bg.image_darken) }}
+  {{ end }}
+
   {{ with $st.Params.design.spacing.padding }}
   {{ with $st.Params.design.spacing.padding }}
     {{ $style_pad := printf "padding: %s;" (delimit . " ") }}
     {{ $style_pad := printf "padding: %s;" (delimit . " ") }}
     {{ $style = print $style $style_pad }}
     {{ $style = print $style $style_pad }}
@@ -103,7 +103,7 @@
   {{ $use_cols := in (slice "pages" "featured" "experience" "accomplishments" "contact" "blank" "tag_cloud" "portfolio") $widget }}
   {{ $use_cols := in (slice "pages" "featured" "experience" "accomplishments" "contact" "blank" "tag_cloud" "portfolio") $widget }}
 
 
   {{/* Dedicated child div for bg prevents parallax 100% height issue within new CSS grid page wrapper. */}}
   {{/* Dedicated child div for bg prevents parallax 100% height issue within new CSS grid page wrapper. */}}
-  <section id="{{$hash_id}}" class="home-section {{$widget_class}} {{if $bg.text_color_light}}dark{{end}} {{with $css_classes}}{{.}}{{end}}" {{with $style}}style="{{. | safeCSS}}"{{end}} {{print $extra_attributes | safeHTMLAttr}}>
+  <section id="{{$hash_id}}" class="home-section {{$widget_class}} {{if $bg.text_color_light}}dark{{else if (eq $bg.text_color_light false)}}light{{end}} {{with $css_classes}}{{.}}{{end}}" {{with $style}}style="{{. | safeCSS}}"{{end}} {{print $extra_attributes | safeHTMLAttr}}>
    <div class="home-section-bg {{if $bg.image}} bg-image{{if ($bg.image_parallax | default true) }} parallax{{end}}{{end}}" {{with $style_bg}}style="{{. | safeCSS}}"{{end}}></div>
    <div class="home-section-bg {{if $bg.image}} bg-image{{if ($bg.image_parallax | default true) }} parallax{{end}}{{end}}" {{with $style_bg}}style="{{. | safeCSS}}"{{end}}></div>
     {{if $use_container}}<div class="container">{{end}}
     {{if $use_container}}<div class="container">{{end}}
 
 

+ 2 - 2
wowchemy/layouts/partials/widgets/about.html

@@ -80,7 +80,7 @@
 
 
       {{ with $person.interests }}
       {{ with $person.interests }}
       <div class="col-md-5">
       <div class="col-md-5">
-        <h3>{{ i18n "interests" | markdownify }}</h3>
+        <div class="section-subheading">{{ i18n "interests" | markdownify }}</div>
         <ul class="ul-interests">
         <ul class="ul-interests">
           {{ range . }}
           {{ range . }}
           <li>{{ . | markdownify | emojify }}</li>
           <li>{{ . | markdownify | emojify }}</li>
@@ -91,7 +91,7 @@
 
 
       {{ with $person.education }}
       {{ with $person.education }}
       <div class="col-md-7">
       <div class="col-md-7">
-        <h3>{{ i18n "education" | markdownify }}</h3>
+        <div class="section-subheading">{{ i18n "education" | markdownify }}</div>
         <ul class="ul-edu fa-ul">
         <ul class="ul-edu fa-ul">
           {{ range .courses }}
           {{ range .courses }}
           <li>
           <li>

+ 1 - 1
wowchemy/layouts/partials/widgets/accomplishments.html

@@ -11,7 +11,7 @@
     <div class="card experience course">
     <div class="card experience course">
       <div class="card-body">
       <div class="card-body">
         {{- with .url -}}<a href="{{.}}" target="_blank" rel="noopener">{{- end -}}
         {{- with .url -}}<a href="{{.}}" target="_blank" rel="noopener">{{- end -}}
-        <h4 class="card-title exp-title text-muted my-0">{{.title | markdownify | emojify}}</h4>
+        <div class="section-subheading card-title exp-title text-muted my-0">{{.title | markdownify | emojify}}</div>
         {{- with .url -}}</a>{{- end -}}
         {{- with .url -}}</a>{{- end -}}
 
 
         <div class="card-subtitle my-0 article-metadata">
         <div class="card-subtitle my-0 article-metadata">

+ 3 - 3
wowchemy/layouts/partials/widgets/experience.html

@@ -28,10 +28,10 @@
     <div class="col py-2">
     <div class="col py-2">
       <div class="card">
       <div class="card">
         <div class="card-body">
         <div class="card-body">
-          <h4 class="card-title exp-title text-muted mt-0 mb-1">{{.title | markdownify | emojify}}</h4>
-          <h4 class="card-title exp-company text-muted my-0">
+          <div class="section-subheading card-title exp-title text-muted mt-0 mb-1">{{.title | markdownify | emojify}}</div>
+          <div class="section-subheading card-title exp-company text-muted my-0">
             {{- with .company_url}}<a href="{{.}}" target="_blank" rel="noopener">{{end}}{{.company | markdownify | emojify}}{{with .company_url}}</a>{{end -}}
             {{- with .company_url}}<a href="{{.}}" target="_blank" rel="noopener">{{end}}{{.company | markdownify | emojify}}{{with .company_url}}</a>{{end -}}
-          </h4>
+          </div>
           <div class="text-muted exp-meta">
           <div class="text-muted exp-meta">
             {{ (time .date_start).Format ($page.Params.date_format | default "January 2006") }} –
             {{ (time .date_start).Format ($page.Params.date_format | default "January 2006") }} –
             {{ if .date_end}}
             {{ if .date_end}}

+ 1 - 1
wowchemy/layouts/partials/widgets/featurette.html

@@ -34,7 +34,7 @@
       {{- end -}}
       {{- end -}}
     </div>
     </div>
     {{ end }}
     {{ end }}
-    <h3>{{ .name | markdownify | emojify }}</h3>
+    <div class="section-subheading">{{ .name | markdownify | emojify }}</div>
     {{ with .description }}<p>{{ . | markdownify | emojify }}</p>{{ end }}
     {{ with .description }}<p>{{ . | markdownify | emojify }}</p>{{ end }}
   </div>
   </div>
   {{ end }}
   {{ end }}

+ 24 - 5
wowchemy/layouts/partials/widgets/hero.html

@@ -31,7 +31,7 @@
         {{ $target = "target=\"_blank\" rel=\"noopener\"" }}
         {{ $target = "target=\"_blank\" rel=\"noopener\"" }}
       {{ end }}
       {{ end }}
     <p class="cta-btns">
     <p class="cta-btns">
-      <a href="{{ $link | safeURL }}" {{ $target | safeHTMLAttr }} class="btn {{if $bg.text_color_light}}btn-light{{else}}btn-primary{{end}} btn-lg">{{ if $page.Params.cta.icon }}<i class="{{ $pack }} {{ $pack_prefix }}-{{ $page.Params.cta.icon }} pr-1" aria-hidden="true"></i>{{end}}{{ $page.Params.cta.label | markdownify | emojify | safeHTML }}</a>
+      <a href="{{ $link | safeURL }}" {{ $target | safeHTMLAttr }} class="btn {{if $bg.text_color_light}}btn-light{{else}}btn-primary{{end}} btn-lg mb-3 mb-md-1">{{ if $page.Params.cta.icon }}<i class="{{ $pack }} {{ $pack_prefix }}-{{ $page.Params.cta.icon }} pr-1" aria-hidden="true"></i>{{end}}{{ $page.Params.cta.label | markdownify | emojify | safeHTML }}</a>
 
 
       {{/* Alternative Call-to-action link */}}
       {{/* Alternative Call-to-action link */}}
       {{ if $page.Params.cta_alt.url }}
       {{ if $page.Params.cta_alt.url }}
@@ -43,24 +43,43 @@
         {{ else if in (slice "http" "https") $scheme }}
         {{ else if in (slice "http" "https") $scheme }}
           {{ $target = "target=\"_blank\" rel=\"noopener\"" }}
           {{ $target = "target=\"_blank\" rel=\"noopener\"" }}
         {{ end }}
         {{ end }}
-      <a href="{{ $link | safeURL }}" {{ $target | safeHTMLAttr }} class="hero-cta-alt pl-4">{{ $page.Params.cta_alt.label | markdownify | emojify | safeHTML }} <i class="fas fa-angle-right"></i></a>
+      <a href="{{ $link | safeURL }}" {{ $target | safeHTMLAttr }} class="hero-cta-alt btn-lg pl-md-4">{{ $page.Params.cta_alt.label | markdownify | emojify | safeHTML }} <i class="fas fa-angle-right"></i></a>
       {{ end }}
       {{ end }}
     </p>
     </p>
     {{ end }}
     {{ end }}
 
 
     {{/* Call-to-action note */}}
     {{/* Call-to-action note */}}
     {{ with $page.Params.cta_note }}
     {{ with $page.Params.cta_note }}
-    <p class="hero-note text-muted mb-0">
+    <p class="hero-note text-muted mb-3 mb-md-1">
       {{ .label | markdownify | emojify | safeHTML }}
       {{ .label | markdownify | emojify | safeHTML }}
     </p>
     </p>
     {{ end }}
     {{ end }}
 
 
   {{/* Hero image */}}
   {{/* Hero image */}}
   {{ if $page.Params.hero_media }}
   {{ if $page.Params.hero_media }}
-    {{ $media_dir := $.Scratch.Get "media_dir" }}
   </div>
   </div>
   <div class="col-12 mx-auto col-md-6 order-md-2 hero-media">
   <div class="col-12 mx-auto col-md-6 order-md-2 hero-media">
-    <img src="{{ printf "%s/%s" $media_dir $page.Params.hero_media | relURL }}" alt="">
+    {{ $image := $page.Parent.Resources.GetMatch $page.Params.hero_media }}
+    {{ if $image }}
+      {{ $legacy_img := $image.Resize "400x" }}
+      {{ $img_src := "" }}
+      {{ $img_src_set := slice }}
+      {{ $widths := slice 1200 800 400 }}
+
+      {{ range $widths }}
+        {{ $src_link := ($image.Resize (printf "%dx" .)).RelPermalink }}
+        {{ if eq $img_src "" }}
+          {{ $img_src = $src_link }}
+        {{ end }}
+        {{ $img_src_set = $img_src_set | append (printf "%s %dw" $src_link .) }}
+      {{ end }}
+      {{ $img_src_set = delimit $img_src_set "," }}
+
+      <img src="{{ $legacy_img.RelPermalink }}" srcset="{{ $img_src_set }}" width="{{ $image.Width }}" height="{{ $image.Height }}" alt="{{ $page.Title }}">
+    {{ else }}
+      {{ $media_dir := $.Scratch.Get "media_dir" }}
+      <img src="{{ printf "%s/%s" $media_dir $page.Params.hero_media | relURL }}" alt="{{ $page.Title }}">
+    {{ end }}
   </div>
   </div>
 </div>
 </div>
 {{ end }}
 {{ end }}