diff --git a/assets/css/style.css b/assets/css/style.css index 9708038..3d89a12 100644 --- a/assets/css/style.css +++ b/assets/css/style.css @@ -431,7 +431,7 @@ h6 { } /* Limit the maximum size of images in the about page */ -section img[src*="Neurophysiology-min.png"] { +section img[src*="Neurophysiology-min"] { width: 100% !important; max-width: 800px !important; margin: 0 auto !important; @@ -439,7 +439,7 @@ section img[src*="Neurophysiology-min.png"] { } /* Limit the maximum size of pynapple graphic abstract image */ -.content img[src*="pynapple/GraphicAbstract.png"] { +.content img[src*="pynapple/GraphicAbstract"] { width: 100% !important; max-width: 600px !important; margin: 0 auto !important; @@ -448,10 +448,10 @@ section img[src*="Neurophysiology-min.png"] { /* Ensure the image is responsive on smaller screens */ @media (max-width: 900px) { - section img[src*="Neurophysiology-min.png"] { + section img[src*="Neurophysiology-min"] { max-width: 95% !important; } - .content img[src*="pynapple/GraphicAbstract.png"] { + .content img[src*="pynapple/GraphicAbstract"] { max-width: 90% !important; } } diff --git a/hugo.yaml b/hugo.yaml index df8463b..c85e82d 100644 --- a/hugo.yaml +++ b/hugo.yaml @@ -24,3 +24,7 @@ module: mounts: - source: assets target: assets + # Lets templates resize images that live in static/images. See + # layouts/partials/img-src.html. + - source: static/images + target: assets/images diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html new file mode 100644 index 0000000..d80d6bb --- /dev/null +++ b/layouts/_default/_markup/render-image.html @@ -0,0 +1,2 @@ +{{ .PlainText }} +{{- /* chomp trailing newline */ -}} diff --git a/layouts/about-nwb/list.html b/layouts/about-nwb/list.html index 15d2972..3fff5d0 100644 --- a/layouts/about-nwb/list.html +++ b/layouts/about-nwb/list.html @@ -12,7 +12,7 @@

{{ .Title | markdownify }}<
- +
@@ -42,7 +42,7 @@

{{ .title | markdownify }}

- +
@@ -75,7 +75,7 @@

{{ .title | markdownify }}

{{ . | markdownify }}

{{ end }} {{ with .image }} - nwb-neuro + nwb-neuro {{ end }} {{ with .wide_image }}
@@ -100,7 +100,7 @@

{{ .title | markdownify }}
- +
{{ .title | markdownify }} @@ -132,7 +132,7 @@

{{ .title | markdownify }}

{{ . | markdownify }}

{{ end }} {{ with .image }} - nwb-neuro + nwb-neuro {{ end }} {{ with .wide_image }}
diff --git a/layouts/archives/list.html b/layouts/archives/list.html index 521f899..66c3347 100644 --- a/layouts/archives/list.html +++ b/layouts/archives/list.html @@ -21,7 +21,7 @@

{{ .title | markdownify }}

- {{ .title }} + {{ .title }}
{{ .title | markdownify }}

{{ .content | markdownify }}

diff --git a/layouts/community/educators.html b/layouts/community/educators.html index 539b1e6..ab929b2 100644 --- a/layouts/community/educators.html +++ b/layouts/community/educators.html @@ -49,7 +49,7 @@

{{ .title | markdownify }}

{{ if .image }}
{{ end }} @@ -99,7 +99,7 @@

{{ .title | markdownify }}

{{ if .image }} {{ end }} diff --git a/layouts/community/gallery.html b/layouts/community/gallery.html index e44ca85..6f1d550 100644 --- a/layouts/community/gallery.html +++ b/layouts/community/gallery.html @@ -35,7 +35,7 @@

{{ .title | markdownify }}

{{ if .image }} {{ end }} @@ -71,7 +71,7 @@

{{ .title | markdownify }}

{{ if .image }} {{ end }} @@ -106,7 +106,7 @@

{{ .title | markdownify }}

diff --git a/layouts/contact-us/list.html b/layouts/contact-us/list.html index 114f53b..17433e2 100644 --- a/layouts/contact-us/list.html +++ b/layouts/contact-us/list.html @@ -21,7 +21,7 @@

{{ .title | markdownify }}

- +
{{ .title | markdownify }}

{{ .content | markdownify }}

@@ -54,7 +54,7 @@

{{ .title | markdownify }}

- +

{{ .title | markdownify }}

diff --git a/layouts/convert/list.html b/layouts/convert/list.html index 1e83288..a9039fc 100644 --- a/layouts/convert/list.html +++ b/layouts/convert/list.html @@ -44,7 +44,7 @@

Available Tools

{{ with .icon }} - + {{ end }} {{ with .title }}

{{ . | markdownify }}

diff --git a/layouts/enhancement-proposals/list.html b/layouts/enhancement-proposals/list.html index f6b325a..8710a62 100644 --- a/layouts/enhancement-proposals/list.html +++ b/layouts/enhancement-proposals/list.html @@ -25,7 +25,7 @@

{{ . | markdownify }}

{{ range $i, $p := .items }}
- +
{{ if .heading }} @@ -44,7 +44,7 @@

{{ . | markdownify }}

{{ range $index, $params := .nested_list }}
- +
{{ .heading | markdownify }} diff --git a/layouts/event-cards/list.html b/layouts/event-cards/list.html index f2ef9d7..c7ff447 100644 --- a/layouts/event-cards/list.html +++ b/layouts/event-cards/list.html @@ -16,7 +16,7 @@

{{ .Title | markdownify
- +

{{ .title | markdownify }}

diff --git a/layouts/events/list.html b/layouts/events/list.html index 94b076c..b1350ff 100644 --- a/layouts/events/list.html +++ b/layouts/events/list.html @@ -13,7 +13,7 @@

{{ .title | markdownify }}<

{{ .content | markdownify }}

- NWB Events + NWB Events
diff --git a/layouts/events/single.html b/layouts/events/single.html index 5768684..8072afc 100644 --- a/layouts/events/single.html +++ b/layouts/events/single.html @@ -17,7 +17,7 @@

{{ .Title | markdownify
{{ if .Params.image }}
- {{ .Title }} + {{ .Title }}
{{ end }}
diff --git a/layouts/grants-and-projects/list.html b/layouts/grants-and-projects/list.html index 06eed4b..e4303e6 100644 --- a/layouts/grants-and-projects/list.html +++ b/layouts/grants-and-projects/list.html @@ -22,7 +22,7 @@

{{ .title | markdownify }}

{{ .content | markdownify }}

- +
{{ end }} @@ -134,7 +134,7 @@

Past Projects

- +

{{ .title | markdownify }}

@@ -163,7 +163,7 @@

{{ .title | markdownify }}

{{ .content | markdownify }}

- +
diff --git a/layouts/index.html b/layouts/index.html index 0d07224..97aec44 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -65,7 +65,7 @@

{{ .title | markdownify }}
- about-nwb + about-nwb

{{ .title | markdownify }}

@@ -86,7 +86,7 @@

{{ .title | markdownify }}
- nwb-portfolio + nwb-portfolio

{{ .heading | markdownify }}

@@ -96,7 +96,7 @@

{{ .heading | markdownify }}

{{ range .logos }}
- nwb-achivements + nwb-achivements
{{ end }}
@@ -154,7 +154,7 @@

Latest N
- +
@@ -208,7 +208,7 @@

Current Sponsors

{{ range .logos }} {{ end }} diff --git a/layouts/news/list.html b/layouts/news/list.html index cab08cf..ec718cc 100644 --- a/layouts/news/list.html +++ b/layouts/news/list.html @@ -43,7 +43,7 @@

All Post

{{ range $paginator.Pages }}
- +
{{ with .Date }} @@ -119,7 +119,7 @@

Recent News

-
diff --git a/layouts/news/single.html b/layouts/news/single.html index 9f0c26f..0115450 100644 --- a/layouts/news/single.html +++ b/layouts/news/single.html @@ -31,7 +31,7 @@

{{ .Title | markdownify }}

-
@@ -110,7 +110,7 @@

{{ .Title | markdownify }}

- +

{{ .name }}

@@ -147,7 +147,7 @@

Recent News

-
diff --git a/layouts/nwb-software/list.html b/layouts/nwb-software/list.html index 0ab64a0..a552af6 100644 --- a/layouts/nwb-software/list.html +++ b/layouts/nwb-software/list.html @@ -21,7 +21,7 @@

{{ .title | markdownify }}

- +
@@ -47,7 +47,7 @@
{{ .title | markdownify }}
- +
@@ -139,7 +139,7 @@

{{ .title | markdownify }}

{{ if .image }}
- NWB Tools Architecture + NWB Tools Architecture
{{ end }}
diff --git a/layouts/online-resources/list.html b/layouts/online-resources/list.html index 59c290a..1b62780 100644 --- a/layouts/online-resources/list.html +++ b/layouts/online-resources/list.html @@ -21,7 +21,7 @@

{{ .title | markdownify }}

- +
{{ .title | markdownify }}

{{ .content | markdownify }}

@@ -49,7 +49,7 @@

{{ .title | markdownify }}

- +
{{ .title | markdownify }}

{{ .content | markdownify }}

@@ -77,7 +77,7 @@

{{ .title | markdownify }}

- +
{{ .title | markdownify }}

{{ .content | markdownify }}

@@ -105,7 +105,7 @@

{{ .title | markdownify }}

- +
{{ .title | markdownify }}

{{ .content | markdownify }}

diff --git a/layouts/partials/img-src.html b/layouts/partials/img-src.html new file mode 100644 index 0000000..d91cfda --- /dev/null +++ b/layouts/partials/img-src.html @@ -0,0 +1,37 @@ +{{/* + Returns the URL to use for an image. + + PNG and JPEG files under /images/ that are wider than "width" are scaled down + to that width and converted to WebP. Narrower ones are converted to WebP at + their own size. The converted file is used only when it is smaller than the + original. Anything else (remote URLs, SVG, GIF, small files, paths that do + not resolve) is returned unchanged, so it is always safe to call. + + "width" must be at least as wide as the image is ever displayed, and ideally + twice that so it stays sharp on high-density screens. It defaults to 2000. + + Usage: +*/}} +{{ $src := .src | default "" }} +{{ $width := .width | default 2000 }} +{{ $out := $src }} +{{ if hasPrefix $src "/images/" }} + {{ $parts := split $src "#" }} + {{ $path := index $parts 0 }} + {{ $fragment := "" }} + {{ if gt (len $parts) 1 }}{{ $fragment = printf "#%s" (index $parts 1) }}{{ end }} + {{ with resources.Get (strings.TrimPrefix "/" $path) }} + {{ if and (in (slice "png" "jpeg") .MediaType.SubType) (gt (len .Content) 20000) }} + {{ $webp := "" }} + {{ if gt .Width $width }} + {{ $webp = .Resize (printf "%dx webp q82 lanczos" $width) }} + {{ else }} + {{ $webp = .Process "webp q82" }} + {{ end }} + {{ if lt (len $webp.Content) (len .Content) }} + {{ $out = printf "%s%s" $webp.RelPermalink $fragment }} + {{ end }} + {{ end }} + {{ end }} +{{ end }} +{{ return $out }} diff --git a/layouts/policies/list.html b/layouts/policies/list.html index 26360f9..598520c 100644 --- a/layouts/policies/list.html +++ b/layouts/policies/list.html @@ -25,7 +25,7 @@

{{ . | markdownify }}

{{ range $i, $p := .items }}
- +
{{ if .heading }} @@ -40,7 +40,7 @@

{{ . | markdownify }}

{{ range $index, $params := .nested_list }}
- +
{{ .heading | markdownify }} diff --git a/layouts/publications/list.html b/layouts/publications/list.html index 019a21b..d79d6ca 100644 --- a/layouts/publications/list.html +++ b/layouts/publications/list.html @@ -24,7 +24,7 @@

{{ .Title | markdownify class='bg-white rounded-3 shadow-sm px-3 py-2 d-flex align-items-center gap-2 nav-link sideLink'> {{ with .Params.icon }}
-
{{ end }} @@ -50,7 +50,7 @@

{{ .Title | markdownify }}

{{ with .icon }}
- +
{{ end }}

{{ .title | markdownify }}

@@ -93,7 +93,7 @@

{{ .Title | markdownify }}

{{ with .image }}
- +
{{ end }} {{ end }} @@ -102,7 +102,7 @@

{{ .Title | markdownify }}

{{ with .Params.main_image }}
- +
{{ end }}
diff --git a/layouts/shortcodes/instructors.html b/layouts/shortcodes/instructors.html index 80636cc..de519d8 100644 --- a/layouts/shortcodes/instructors.html +++ b/layouts/shortcodes/instructors.html @@ -4,7 +4,7 @@
{{ with .image }} - + {{ end }}
{{ .name | markdownify }}
{{ with .affiliation }}

{{ . | markdownify }}

{{ end }} diff --git a/layouts/shortcodes/tool-grid.html b/layouts/shortcodes/tool-grid.html index 68dad5f..a473fdc 100644 --- a/layouts/shortcodes/tool-grid.html +++ b/layouts/shortcodes/tool-grid.html @@ -5,7 +5,7 @@
{{ if .Params.image }}
- {{ .Title }} + {{ .Title }}
{{ end }}
diff --git a/layouts/supporting-nwb/list.html b/layouts/supporting-nwb/list.html index 7797168..81c1c01 100644 --- a/layouts/supporting-nwb/list.html +++ b/layouts/supporting-nwb/list.html @@ -63,7 +63,7 @@

{{ .title | markdownify }}

{{ range .actions }}
- +

{{ .title | markdownify }}

{{ .description | markdownify }}

@@ -90,11 +90,11 @@

{{ .title | markdownify }}

- +

{{ .number }}

{{ .label }}

- +

{{ .description | markdownify }}

@@ -111,11 +111,11 @@

{{ .label }}

{{ range .metrics }}
- +

{{ .number }}

{{ .label }}

- +

{{ .description | markdownify }}

@@ -134,7 +134,7 @@

{{ .title | markdownify }}

{{ if .image }} - {{ .name }} + {{ .name }} {{ else }}
diff --git a/layouts/team/list.html b/layouts/team/list.html index bd64e02..cea78b4 100644 --- a/layouts/team/list.html +++ b/layouts/team/list.html @@ -43,7 +43,7 @@

Current Membership of the Executive {{ range $index, $element := .team_members }}
- +
{{ $element.name | markdownify }}
{{ if $element.post }}

{{ $element.post | markdownify }}

{{ end }}
@@ -117,7 +117,7 @@

Current Membership of the Technical {{ range $i, $p := .team_members }}
- +
{{ $p.name | markdownify }}
{{ if $p.post }}

{{ $p.post | markdownify }}

{{ end }}
@@ -182,7 +182,7 @@

NWB Core Software

- +
{{ .name | markdownify }}
@@ -206,7 +206,7 @@

NWB Community Liaison

- +
{{ .name | markdownify }}
@@ -230,7 +230,7 @@

Previous Members

- +
{{ .name | markdownify }}
diff --git a/layouts/working-groups/list.html b/layouts/working-groups/list.html index 7546d4a..38376d7 100644 --- a/layouts/working-groups/list.html +++ b/layouts/working-groups/list.html @@ -33,7 +33,7 @@

{{ .content | markdownify }}

- +
@@ -52,7 +52,7 @@

Past Working Groups

- +

{{