Browse Source

more lighthouse fixes; simplifications to scss

simplify
Alexander Avery 3 weeks ago
parent
commit
3f92309a91
  1. 21
      assets/sass/main.scss
  2. 8
      layouts/authors/list.html
  3. 6
      layouts/partials/image-small.html
  4. 8
      layouts/partials/image.html

21
assets/sass/main.scss

@ -1,7 +1,6 @@
@import 'colors.scss'; @import 'colors.scss';
@import 'cards.scss'; @import 'cards.scss';
@import 'code.scss'; @import 'code.scss';
@import 'fonts.scss';
@mixin screen-max($max) { @mixin screen-max($max) {
@media (max-width: $max - 1) { @media (max-width: $max - 1) {
@ -22,22 +21,24 @@ header {
background-color: $top-bar; background-color: $top-bar;
box-shadow: 0px 5px 10px black; box-shadow: 0px 5px 10px black;
nav { nav {
@include screen-max(840px){text-align: center;} @include screen-max(500px){text-align: center;}
div {display: inline-block;}
img { max-width: 300px; } img { max-width: 300px; }
a { a {
margin-right: 12px; margin-right: 12px;
font-weight: bold; font-weight: bold;
text-decoration: none; text-decoration: none;
color: $font-color-alternate; &, &:visited, &:hover {color: $font-color-alternate;}
&:visited {color: $font-color-alternate;}
} }
} }
} }
header, main, section, nav {padding: 0 16px;} header, main, section {padding: 0 16px;}
main, section, nav {max-width: 920px; margin: auto;} nav, main, section {max-width: 1200px; margin: auto;}
main img {max-width: 100%} main img {max-width: 100%}
footer {text-align: center;} footer {text-align: center;}
@ -48,13 +49,13 @@ a {
&:visited, &:hover { color: $link-color-visited; } &:visited, &:hover { color: $link-color-visited; }
} }
img.featured { img.featured{aspect-ratio: 4/3;}
img.featured, img.author {
display: block; display: block;
border-radius: 8px; border-radius: 8px;
margin: 12px auto; margin: 12px 0;
max-height: 888px;
object-fit: cover; object-fit: cover;
aspect-ratio: 4/3; max-height: 500px;
} }
.left-to-right { .left-to-right {

8
layouts/authors/list.html

@ -1,14 +1,12 @@
{{ define "main" }} {{ define "main" }}
<section class="left-to-right"> <section>
{{ with .Resources.GetMatch "avatar" }} {{ with .Resources.GetMatch "avatar" }}
<img class="shadow featured" src="{{ .RelPermalink }}" alt="{{ .Params.alt }}"/> <img class="shadow author" src="{{ .RelPermalink }}" alt="{{ .Params.alt }}"/>
{{ end }} {{ end }}
<div> <div>
<h1>{{ .Params.name }}</h1> <h1>{{ .Params.name }}</h1>
<p>{{ .Params.bio }}</p>
<a href={{ .Params.projects }}>Projects</a> <a href={{ .Params.projects }}>Projects</a>
<span> | </span> <span> | </span>
<a href="mailto:{{ .Params.email }}">{{ .Params.email}}</a> <a href="mailto:{{ .Params.email }}">{{ .Params.email}}</a>
@ -21,7 +19,7 @@
</main> </main>
<section> <section>
<h2>Latest Posts:</h2> <h2>Posts:</h2>
{{ with .Data.Pages }} {{ with .Data.Pages }}
<section class="article-list"> <section class="article-list">
{{ range . }} {{ range . }}

6
layouts/partials/image-small.html

@ -1,18 +1,18 @@
<img class="{{ .class }}" <img class="{{ .class }}"
{{- with .image -}} {{- with .image -}}
{{ $smallest := (.Resize "305x q60") }} {{ $smallest := (.Resize "305x webp q60") }}
srcset=" srcset="
{{- with $smallest -}} {{- with $smallest -}}
{{ printf "%s %dw," .RelPermalink .Width }} {{ printf "%s %dw," .RelPermalink .Width }}
{{- end -}} {{- end -}}
{{- with (.Resize "480x q60") -}} {{- with (.Resize "480x webp q60") -}}
{{ printf "%s %dw," .RelPermalink .Width }} {{ printf "%s %dw," .RelPermalink .Width }}
{{- end -}} {{- end -}}
{{- with (.Resize "600x q70") -}} {{- with (.Resize "600x webp q70") -}}
{{ printf "%s %dw," .RelPermalink .Width }} {{ printf "%s %dw," .RelPermalink .Width }}
{{- end -}} {{- end -}}
" "

8
layouts/partials/image.html

@ -1,22 +1,22 @@
<img class="{{ .class }}" <img class="{{ .class }}"
{{- with .image -}} {{- with .image -}}
{{ $smallest := (.Resize "320x q60") }} {{ $smallest := (.Resize "320x webp q60") }}
srcset=" srcset="
{{- with $smallest -}} {{- with $smallest -}}
{{ printf "%s %dw," .RelPermalink .Width }} {{ printf "%s %dw," .RelPermalink .Width }}
{{- end -}} {{- end -}}
{{- with (.Resize "480x q60") -}} {{- with (.Resize "480x webp q60") -}}
{{ printf "%s %dw," .RelPermalink .Width }} {{ printf "%s %dw," .RelPermalink .Width }}
{{- end -}} {{- end -}}
{{- with (.Resize "600x q70") -}} {{- with (.Resize "600x webp q70") -}}
{{ printf "%s %dw," .RelPermalink .Width }} {{ printf "%s %dw," .RelPermalink .Width }}
{{- end -}} {{- end -}}
{{- with (.Resize "800x q90") -}} {{- with (.Resize "800x webp q90") -}}
{{ printf "%s %dw," .RelPermalink .Width }} {{ printf "%s %dw," .RelPermalink .Width }}
{{- end -}} {{- end -}}

Loading…
Cancel
Save