MVP
This commit is contained in:
parent
6938e212ba
commit
62f343ef90
40 changed files with 2171 additions and 149 deletions
13
layouts/partials/components/button.html
Normal file
13
layouts/partials/components/button.html
Normal file
|
@ -0,0 +1,13 @@
|
|||
<!--
|
||||
type: string - default filled
|
||||
text: string
|
||||
icon: string (optional)
|
||||
url: string
|
||||
-->
|
||||
{{ $outlined := "outlined"}}
|
||||
<a class="{{if eq .type $outlined}} button-outlined {{else}} button-filled {{end}}" href="{{ .url }}">
|
||||
{{ with .icon }}
|
||||
<i class="icon-{{ . }}"></i>
|
||||
{{ end }}
|
||||
{{ .text }}
|
||||
</a>
|
9
layouts/partials/components/icon.html
Normal file
9
layouts/partials/components/icon.html
Normal file
|
@ -0,0 +1,9 @@
|
|||
<!--
|
||||
type: string - default: link
|
||||
text: string (optional)
|
||||
url: string
|
||||
-->
|
||||
<a href="{{ .url }}" rel="{{ .rel }}">
|
||||
<i class="{{ if .type }} icon-{{ .type }} {{ else }} icon-link {{ end }}"></i>
|
||||
{{ if .text }} {{ .text }}{{ end }}
|
||||
</a>
|
56
layouts/partials/components/image.html
Normal file
56
layouts/partials/components/image.html
Normal file
|
@ -0,0 +1,56 @@
|
|||
<!--
|
||||
type: string - default empty
|
||||
img: image
|
||||
url: string
|
||||
alt: string
|
||||
caption: string
|
||||
-->
|
||||
{{ $img := .img }}
|
||||
{{ if not $img }}
|
||||
{{ $img = resources.Get .url }}
|
||||
{{ if not $img }}
|
||||
{{ $img := resources.GetRemote .url | resources.Copy (path.Join "images" (path.Base .url )) }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ if $img }}
|
||||
{{ $url := $img.RelPermalink }}
|
||||
{{ $width := $img.Width }}
|
||||
{{ $height := $img.Height }}
|
||||
{{ $sizes := slice "320" "640" "960" "1280" }}
|
||||
{{ $ext := path.Ext $url }}
|
||||
{{ $name := path.Base (replace $url $ext "") }}
|
||||
{{ $dir := path.Dir $url }}
|
||||
{{ $mediaWidthControl := "(min-width: 1240px) 50px, 70vw" }}
|
||||
|
||||
<picture>
|
||||
{{- if eq hugo.Environment "development" }}
|
||||
<img class="{{ .type }}" width="{{ $width }}" height="{{ $height }}" src="{{ $url }}" alt="{{ .alt }}" loading="lazy"
|
||||
decoding="async">
|
||||
{{ else }}
|
||||
<source type="image/avif" srcset="
|
||||
{{ range $i, $size := $sizes }}
|
||||
{{ $dir }}/{{ $name }}-{{ $size }}{{ $ext }}.avif {{ $size }}w,
|
||||
{{ end }}
|
||||
{{ $url }}.avif {{ $width }}w
|
||||
" sizes="{{ $mediaWidthControl }}" />
|
||||
<source type="image/webp" srcset="
|
||||
{{ range $i, $size := $sizes }}
|
||||
{{ $dir }}/{{ $name }}-{{ $size }}{{ $ext }}.webp {{ $size }}w,
|
||||
{{ end }}
|
||||
{{ $url }}.webp {{ $width }}w
|
||||
" sizes="{{ $mediaWidthControl }}" />
|
||||
<img class="{{ .type }}" width="{{ $width }}" height="{{ $height }}" srcset="
|
||||
{{ range $i, $size := $sizes }}
|
||||
{{ $dir }}/{{ $name }}-{{ $size }}{{ $ext }} {{ $size }}w,
|
||||
{{ end }}
|
||||
{{ $url }} {{ $width }}w
|
||||
" src="{{ $url }}" alt="{{ .alt }}" loading="lazy" decoding="async">
|
||||
{{ end }}
|
||||
</picture>
|
||||
{{ if .caption }}
|
||||
<p class="caption">{{ .caption }}</p>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{/* https://www.brycewray.com/posts/2023/05/better-code-image-processing-hugo-render-hook-edition/ */}}
|
|
@ -1 +0,0 @@
|
|||
<p>Copyright {{ now.Year }}. All rights reserved.</p>
|
|
@ -1,5 +1,7 @@
|
|||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<title>{{ if .IsHome }}{{ site.Title }}{{ else }}{{ printf "%s | %s" .Title site.Title }}{{ end }}</title>
|
||||
<meta name="color-scheme" content="dark">
|
||||
{{ template "_internal/opengraph.html" . }}
|
||||
<title>{{ if .Title }}{{ .Title }}{{ else }}{{ .Site.Title }}{{ end }}</title>
|
||||
{{ partialCached "head/css.html" . }}
|
||||
{{ partialCached "head/js.html" . }}
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
{{- with resources.Get "css/main.css" }}
|
||||
{{- if eq hugo.Environment "development" }}
|
||||
<link rel="stylesheet" href="{{ .RelPermalink }}">
|
||||
{{- else }}
|
||||
{{- with . | minify | fingerprint }}
|
||||
<link rel="stylesheet" href="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous">
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with resources.Get "scss/main.scss" | resources.ExecuteAsTemplate "css/main.css" . | resources.ToCSS (dict "outputStyle" "compressed") | minify | fingerprint }}
|
||||
<link rel="stylesheet" href="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous">
|
||||
{{- end }}
|
||||
<link rel="stylesheet" type="text/css" href="/icons/fontawesome.css">
|
||||
|
|
|
@ -1,2 +1,6 @@
|
|||
<h1>{{ site.Title }}</h1>
|
||||
{{ partial "menu.html" (dict "menuID" "main" "page" .) }}
|
||||
<h2><a href="/">{{ .Site.Title }}</a></h2>
|
||||
{{ range .Site.Pages }}
|
||||
{{ if .Params.nav }}
|
||||
<h2><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></h2>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
{{- /*
|
||||
For a given taxonomy, renders a list of terms assigned to the page.
|
||||
|
||||
@context {page} page The current page.
|
||||
@context {string} taxonomy The taxonony.
|
||||
|
||||
@example: {{ partial "terms.html" (dict "taxonomy" "tags" "page" .) }}
|
||||
*/}}
|
||||
|
||||
{{- $page := .page }}
|
||||
{{- $taxonomy := .taxonomy }}
|
||||
|
||||
{{- with $page.GetTerms $taxonomy }}
|
||||
{{- $label := (index . 0).Parent.LinkTitle }}
|
||||
<div>
|
||||
<div>{{ $label }}:</div>
|
||||
<ul>
|
||||
{{- range . }}
|
||||
<li><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></li>
|
||||
{{- end }}
|
||||
</ul>
|
||||
</div>
|
||||
{{- end }}
|
Loading…
Add table
Add a link
Reference in a new issue