Skip to content

Commit

Permalink
content/authors: switch to key things by GitHub handle
Browse files Browse the repository at this point in the history
This also means we can DRY up a whole load of code (I've done a partial
job for now) and can simply use https://github.com/$user.png for the
image rather than needing to store anything locally.

We can DRY this all up even more using CUE at a later date.

Signed-off-by: Paul Jolly <[email protected]>
Change-Id: I10864ba9096d8682843ffcf46848019db0e92a67
Preview-Path: /blog/example/
Dispatch-Trailer: {"type":"trybot","CL":1169614,"patchset":4,"ref":"refs/changes/14/1169614/4","targetBranch":"alpha"}
  • Loading branch information
myitcv authored and cueckoo committed Sep 19, 2023
1 parent 5f01e94 commit 52b4f93
Show file tree
Hide file tree
Showing 23 changed files with 46 additions and 62 deletions.
6 changes: 0 additions & 6 deletions content/authors/jonathanmatthews/en.md

This file was deleted.

3 changes: 0 additions & 3 deletions content/authors/jonathanmatthews/page.cue

This file was deleted.

4 changes: 4 additions & 0 deletions content/authors/jpluscplusm/en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
name: "Jonathan Matthews"
github: "jpluscplusm"
---
3 changes: 3 additions & 0 deletions content/authors/jpluscplusm/page.cue
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package site

"authors": "jpluscplusm": {}
6 changes: 0 additions & 6 deletions content/authors/marcelvanlohuizen/en.md

This file was deleted.

3 changes: 0 additions & 3 deletions content/authors/marcelvanlohuizen/page.cue

This file was deleted.

4 changes: 4 additions & 0 deletions content/authors/mpvl/en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
name: "Marcel van Lohuizen"
github: "mpvl"
---
3 changes: 3 additions & 0 deletions content/authors/mpvl/page.cue
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package site

"authors": "mpvl": {}
4 changes: 4 additions & 0 deletions content/authors/myitcv/en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
name: "Paul Jolly"
github: "myitcv"
---
3 changes: 3 additions & 0 deletions content/authors/myitcv/page.cue
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package site

"authors": "myitcv": {}
6 changes: 0 additions & 6 deletions content/authors/pauljolly/en.md

This file was deleted.

3 changes: 0 additions & 3 deletions content/authors/pauljolly/page.cue

This file was deleted.

Binary file removed content/authors/pauljolly/pauljolly.jpeg
Binary file not shown.
4 changes: 2 additions & 2 deletions content/blog/example/en.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ draft: false
noindex: true
image: "cow.jpg"
authors:
- pauljolly
- jonathanmatthews
- myitcv
- jpluscplusm
tags:
- Use encodings in CUE
- Language
Expand Down
6 changes: 0 additions & 6 deletions hugo/content/en/authors/jonathanmatthews/index.md

This file was deleted.

4 changes: 4 additions & 0 deletions hugo/content/en/authors/jpluscplusm/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
name: "Jonathan Matthews"
github: "jpluscplusm"
---
6 changes: 0 additions & 6 deletions hugo/content/en/authors/marcelvanlohuizen/index.md

This file was deleted.

4 changes: 4 additions & 0 deletions hugo/content/en/authors/mpvl/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
name: "Marcel van Lohuizen"
github: "mpvl"
---
4 changes: 4 additions & 0 deletions hugo/content/en/authors/myitcv/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
name: "Paul Jolly"
github: "myitcv"
---
6 changes: 0 additions & 6 deletions hugo/content/en/authors/pauljolly/index.md

This file was deleted.

Binary file removed hugo/content/en/authors/pauljolly/pauljolly.jpeg
Binary file not shown.
4 changes: 2 additions & 2 deletions hugo/content/en/blog/example/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ draft: false
noindex: true
image: "cow.jpg"
authors:
- pauljolly
- jonathanmatthews
- myitcv
- jpluscplusm
tags:
- Use encodings in CUE
- Language
Expand Down
22 changes: 9 additions & 13 deletions hugo/layouts/partials/authors.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,26 @@
{{ range first 1 $authorMatches }}
<details class="authors__item" data-dropdown>
<summary class="authors__avatar">
{{ if .Params.image }}
<img class="authors__image" src="/{{ .File.Dir }}{{ .Params.image }}" alt="{{ .Params.displayName|default .Params.name }}">
{{ if .Params.github }}
<img class="authors__image" src="https://github.com/{{ .Params.github }}.png" alt="{{ .Params.github|default .Params.name }}">
{{ else }}
{{- partial "icon.html" (dict "icon" "cue" "class" "authors__image") -}}
{{ end }}

{{ if .Params.displayName }}
<span class="authors__display-name">{{ .Params.displayName }}</span>
{{ else }}
<span class="authors__author-name">{{ .Params.name }}</span>
{{ end }}
<span class="authors__author-name">{{ .Params.name }}</span>
</summary>

<div class="authors--popover">
<div class="authors__avatar">
{{ if .Params.image }}
<img class="authors__image" src="/{{ .File.Dir }}{{ .Params.image }}" alt="{{ .Params.displayName|default .Params.name }}">
{{ if .Params.github }}
<img class="authors__image" src="https://github.com/{{ .Params.github }}.png" alt="{{ .Params.github|default .Params.name }}">
{{ else }}
{{- partial "icon.html" (dict "icon" "cue" "class" "authors__image") -}}
{{ end }}

<div class="authors__name">
{{ if .Params.displayName }}
<span class="authors__display-name">{{ .Params.displayName }}</span>
{{ if .Params.gitbhu }}
<span class="authors__display-name">{{ .Params.github }}</span>
{{ end }}

{{ if .Params.name }}
Expand All @@ -42,10 +38,10 @@
</div>

<div class="authors__links">
{{ if .Params.githubLink }}
{{ if .Params.github }}
<div class="authors__github">

<a class="authors__link" href="{{ .Params.githubLink }}">
<a class="authors__link" href="https://github.com/{{ .Params.github }}">
{{ partial "icon.html" (dict "icon" "github" "class" "authors__icon") }}
<p>
<span class="authors__link-text">{{ T "author_github" }}</span>
Expand Down

0 comments on commit 52b4f93

Please sign in to comment.