aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortdro <tdro@noreply.example.com>2025-03-08 00:00:00 +0000
committertdro <tdro@noreply.example.com>2025-03-08 00:00:00 +0000
commit1b71ce4775cbfbc89502f24b322b836c6511b93c (patch)
treeb5012ebc42a8029c43cf2a6e7a3676455bb2633b
parentcca7e735bf6e66ae01cd10a02bb0cda5097a96c9 (diff)
downloadcanory-1b71ce4775cbfbc89502f24b322b836c6511b93c.tar.gz
canory-1b71ce4775cbfbc89502f24b322b836c6511b93c.tar.bz2
canory-1b71ce4775cbfbc89502f24b322b836c6511b93c.zip
themes/default/layouts/partials/profile: Use SVG fallback
-rw-r--r--assets/css/default.css5
-rw-r--r--themes/default/layouts/_default/taxonomy.html4
-rw-r--r--themes/default/layouts/partials/author-header.html21
-rw-r--r--themes/default/layouts/partials/author-picture.html54
-rw-r--r--themes/default/layouts/partials/context-profile.html4
-rw-r--r--themes/default/layouts/partials/profile-picture.html4
-rw-r--r--themes/default/layouts/partials/profile.html26
7 files changed, 65 insertions, 53 deletions
diff --git a/assets/css/default.css b/assets/css/default.css
index f2400e7..67a35ad 100644
--- a/assets/css/default.css
+++ b/assets/css/default.css
@@ -1391,6 +1391,7 @@ profile-box picture[data-type="banner"] img {
border: none;
}
+profile-box figure a svg,
profile-box picture[data-type="profile"] img {
border-radius: 100%;
height: 8rem;
@@ -1400,6 +1401,10 @@ profile-box picture[data-type="profile"] img {
padding: 0.25rem;
}
+profile-box figure a svg text {
+ font-size: 500%;
+}
+
profile-box section {
margin: 1rem 2rem 0 2rem;
display: flex;
diff --git a/themes/default/layouts/_default/taxonomy.html b/themes/default/layouts/_default/taxonomy.html
index c13db6b..7fdaaaa 100644
--- a/themes/default/layouts/_default/taxonomy.html
+++ b/themes/default/layouts/_default/taxonomy.html
@@ -38,9 +38,7 @@
</h2>
<figure>
<a href="{{ print "tags/" $title "/#" (partial "card-id.html" .) | relURL }}">
- <picture>
- {{ partial "author-picture" . }}
- </picture>
+ {{ partial "author-picture" . }}
</a>
</figure>
<time
diff --git a/themes/default/layouts/partials/author-header.html b/themes/default/layouts/partials/author-header.html
index 5bcc0e6..f1e1ade 100644
--- a/themes/default/layouts/partials/author-header.html
+++ b/themes/default/layouts/partials/author-header.html
@@ -1,9 +1,10 @@
-{{- $author := partial "function-authors-data.html" . -}}
-{{- $header := $author.picture.header -}}
-{{- $file := not (urls.Parse $header).Host -}}
+{{- $author := .Section -}}
+{{- $authors := partial "function-authors-data.html" . -}}
+{{- $header := $authors.picture.header -}}
+{{- $file := not (urls.Parse $header).Host -}}
{{- if $file -}}
- {{- $header = print $author.user "/" $header -}}
+ {{- $header = print $author "/" $header -}}
{{- end -}}
{{- $image := partial "function-caches-images.html"
@@ -11,20 +12,20 @@
"Context" .
"Source" $header
"Resize" "x600"
- "Target" (print (partial "function-paths.html").media "/" $author.user "/")
- "Copy" (print (partial "function-paths.html").media "/" $author.user "/" (path.Base $header))
- "AlternateCopy" (print (partial "function-paths.html").media "/" $author.user "/" (path.BaseName $header) ".webp")
+ "Target" (print (partial "function-paths.html").media "/" $author "/")
+ "Copy" (print (partial "function-paths.html").media "/" $author "/" (path.Base $header))
+ "AlternateCopy" (print (partial "function-paths.html").media "/" $author "/" (path.BaseName $header) ".webp")
)
-}}
-{{- with $image.AltRelPermalink -}}
- <source srcset="{{ . }}" type="image/webp" />
+{{- with $srcset := $image.AltRelPermalink -}}
+ <source srcset="{{ $srcset }}" type="image/webp" />
{{- end -}}
<img
width="{{ $image.Width }}"
height="{{ $image.Height }}"
src="{{ $image.RelPermalink }}"
- alt="{{ $author.name }}"
+ alt="{{ $author }}"
/>
{{- /* This comment removes trailing newlines and white spaces. */ -}}
diff --git a/themes/default/layouts/partials/author-picture.html b/themes/default/layouts/partials/author-picture.html
index ac9212b..247f1ab 100644
--- a/themes/default/layouts/partials/author-picture.html
+++ b/themes/default/layouts/partials/author-picture.html
@@ -1,12 +1,14 @@
-{{- $author := partial "function-authors-data.html" . -}}
-{{- $metadata := print "public/" $author.user "/author.json" -}}
+{{- $author := .Section -}}
+{{- $authors := partial "function-authors-data.html" . -}}
+{{- $metadata := print "public/" $author "/author.json" -}}
-{{- $alternate := $author.name -}}
-{{- $width := "" -}}
-{{- $height := "" -}}
-{{- $source := "" -}}
+{{- $width := "" -}}
+{{- $height := "" -}}
+{{- $source := "" -}}
{{- $sourceset := "" -}}
+{{- $alternate := $author -}}
+
{{- with .Params.feed.favicon -}}
{{- $alternate = $.Params.feed.name -}}
{{- $width = "64" -}}
@@ -17,12 +19,12 @@
{{- end -}}
{{- $sourceset = "" -}}
{{- else -}}
- {{- $source = print "/" (partial "function-paths.html").media "/" $author.user "/" $author.user "-profile" (path.Ext $author.picture.profile) -}}
- {{- $sourceset = print "/" (partial "function-paths.html").media "/" $author.user "/" $author.user "-profile.webp" -}}
+ {{- $source = print "/" (partial "function-paths.html").media "/" $author "/" $author "-profile" (path.Ext $authors.picture.profile) -}}
+ {{- $sourceset = print "/" (partial "function-paths.html").media "/" $author "/" $author "-profile.webp" -}}
{{- with $metadata := resources.Get $metadata -}}
{{- with $content := $metadata.Content -}}
{{- $metadata = $content | transform.Unmarshal -}}
- {{- $width = $metadata.picture.profileWidth -}}
+ {{- $width = $metadata.picture.profileWidth -}}
{{- $height = $metadata.picture.profileHeight -}}
{{- end -}}
{{- else -}}
@@ -31,19 +33,27 @@
{{- end -}}
{{- end -}}
-{{- if not (path.Ext $author.picture.profile) -}}
- {{- $source = "/data/media/404.png" -}}
- {{- $sourceset = "" -}}
-{{- end -}}
+{{- if (path.Ext $authors.picture.profile) -}}
+<picture data-type="profile">
+ {{- with $sourceset -}}
+ <source srcset="{{ strings.TrimPrefix "/" $sourceset | relURL }}" type="image/webp" />
+ {{- end -}}
-{{- with $sourceset -}}
-<source srcset="{{ strings.TrimPrefix "/" $sourceset | relURL }}" type="image/webp" />
+ <img
+ width="{{ $width }}"
+ height="{{ $height }}"
+ src="{{ strings.TrimPrefix "/" $source | relURL }}"
+ alt="{{ $alternate }}"
+ />
+</picture>
+{{- else -}}
+<svg xmlns="http://www.w3.org/2000/svg">
+ <text
+ x="50%"
+ y="50%"
+ text-anchor="middle"
+ dominant-baseline="central"
+ >{{ delimit (first 1 (split $author "")) "" | strings.Title }}</text>
+</svg>
{{- end -}}
-
-<img
- width="{{ $width }}"
- height="{{ $height }}"
- src="{{ strings.TrimPrefix "/" $source | relURL }}"
- alt="{{ $alternate }}"
-/>
{{- /* This comment removes trailing newlines and white spaces. */ -}}
diff --git a/themes/default/layouts/partials/context-profile.html b/themes/default/layouts/partials/context-profile.html
index d44b902..601814c 100644
--- a/themes/default/layouts/partials/context-profile.html
+++ b/themes/default/layouts/partials/context-profile.html
@@ -18,9 +18,7 @@
<aside>
<figure>
<a title="{{ $name }}" href="{{ $href }}">
- <picture>
- {{ partial "author-picture" . }}
- </picture>
+ {{ partial "author-picture" . }}
</a>
</figure>
</aside>
diff --git a/themes/default/layouts/partials/profile-picture.html b/themes/default/layouts/partials/profile-picture.html
index 6b56e95..b469f83 100644
--- a/themes/default/layouts/partials/profile-picture.html
+++ b/themes/default/layouts/partials/profile-picture.html
@@ -1,6 +1,4 @@
<figure>
- <picture>
- {{ partial "author-picture.html" . }}
- </picture>
+ {{ partial "author-picture.html" . }}
{{ partial "context-profile.html" . }}
</figure>
diff --git a/themes/default/layouts/partials/profile.html b/themes/default/layouts/partials/profile.html
index ad874bc..fc85903 100644
--- a/themes/default/layouts/partials/profile.html
+++ b/themes/default/layouts/partials/profile.html
@@ -1,8 +1,9 @@
{{- $feed := 0 -}}
{{- $feeds := "Feeds" -}}
-{{- $author := partial "function-authors-data.html" . -}}
+{{- $author := .Section -}}
+{{- $authors := partial "function-authors-data.html" . -}}
-{{- with $author.feeds.rss -}}
+{{- with $authors.feeds.rss -}}
{{- $feed = len . -}}
{{- end -}}
@@ -15,32 +16,33 @@
{{ partial "author-header.html" . }}
</picture>
- <picture data-type="profile">
- {{ partial "author-picture.html" . }}
- </picture>
+ <figure>
+ <a href="">{{ partial "author-picture.html" . }}</a>
+ </figure>
<section>
+
<aside>
- <h2>{{ $author.name }}</h2>
- <h3>@{{ $author.user }}</h3>
+ <h2>{{ $authors.name }}</h2>
+ <h3>@{{ $author }}</h3>
</aside>
- <p>{{ $author.description | markdownify }}</p>
+ <p>{{ $authors.description | markdownify }}</p>
</section>
<footer>
<p>
{{ safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/map-pin.svg")) }}
- <span>{{- $author.place | markdownify -}}</span>
+ <span>{{- $authors.place | markdownify -}}</span>
</p>
<p>
{{ safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/globe.svg")) }}
- <a href="{{ $author.domain.url }}">
- {{- $author.domain.host | markdownify -}}
+ <a href="{{ $authors.domain.url }}">
+ {{- $authors.domain.host | markdownify -}}
</a>
</p>
<p>
{{ safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/clock.svg")) }}
- <span>{{- $author.epoch | markdownify -}}</span>
+ <span>{{- $authors.epoch | markdownify -}}</span>
</p>
<p title="Watching {{ $feed }} {{ $feeds }}">
{{ safeHTML (readFile (print (partial "function-paths.html").static "/icons/tabler/rss.svg")) }}