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 and can simply use
https://github.com/$user.png for the image rather than needing to store
images locally.

We flip to using the directory path as the GitHub handle, because this
is the key by which we identify a user.

This then allows us to elide the declaration of a 'github' field in an
author page.

We flip to allowing the user to declare 'displayName', and use this as
the rendered name in the author block.

Signed-off-by: Paul Jolly <[email protected]>
Change-Id: I10864ba9096d8682843ffcf46848019db0e92a67
Preview-Path: /blog/example/
Dispatch-Trailer: {"type":"trybot","CL":1169614,"patchset":7,"ref":"refs/changes/14/1169614/7","targetBranch":"alpha"}
  • Loading branch information
myitcv authored and cueckoo committed Sep 19, 2023
1 parent 5f01e94 commit 3f9d311
Show file tree
Hide file tree
Showing 27 changed files with 48 additions and 79 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.

3 changes: 3 additions & 0 deletions content/authors/jpluscplusm/en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
displayName: "Jonathan Matthews"
---
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.

3 changes: 3 additions & 0 deletions content/authors/mpvl/en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
displayName: "Marcel van Lohuizen"
---
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": {}
3 changes: 3 additions & 0 deletions content/authors/myitcv/en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
displayName: "Paul Jolly"
---
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
4 changes: 2 additions & 2 deletions content/docs/howto/encode-json-yaml-with-cue/en.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ date: "2023-08-22"
tags:
- Use encodings in CUE
authors:
- pauljolly
- marcelvanlohuizen
- myitcv
- mpvl
meta:
- type: readingTime
value: 5
Expand Down
2 changes: 1 addition & 1 deletion content/examples/basic/front-matter/en.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ tags:
- Language
- Ecosystem
authors:
- pauljolly
- myitcv
---

Hugo uses front-matter to add meta information to a content page. This can be done various formats - in the CUE website we prefer **YAML** (To be decided).
Expand Down
6 changes: 0 additions & 6 deletions hugo/content/en/authors/jonathanmatthews/index.md

This file was deleted.

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

This file was deleted.

3 changes: 3 additions & 0 deletions hugo/content/en/authors/mpvl/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
displayName: "Marcel van Lohuizen"
---
3 changes: 3 additions & 0 deletions hugo/content/en/authors/myitcv/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
displayName: "Paul Jolly"
---
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
4 changes: 2 additions & 2 deletions hugo/content/en/docs/howto/encode-json-yaml-with-cue/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ date: "2023-08-22"
tags:
- Use encodings in CUE
authors:
- pauljolly
- marcelvanlohuizen
- myitcv
- mpvl
meta:
- type: readingTime
value: 5
Expand Down
2 changes: 1 addition & 1 deletion hugo/content/en/examples/basic/front-matter/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ tags:
- Language
- Ecosystem
authors:
- pauljolly
- myitcv
---

Hugo uses front-matter to add meta information to a content page. This can be done various formats - in the CUE website we prefer **YAML** (To be decided).
Expand Down
35 changes: 11 additions & 24 deletions hugo/layouts/partials/authors.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,50 +9,37 @@
{{ 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 }}">
{{ else }}
{{- partial "icon.html" (dict "icon" "cue" "class" "authors__image") -}}
{{ end }}
<img class="authors__image" src="https://github.com/{{ $authorName }}.png" alt="{{ $authorName|default .Params.name }}">

{{ if .Params.displayName }}
<span class="authors__display-name">{{ .Params.displayName }}</span>
{{ else }}
<span class="authors__author-name">{{ .Params.name }}</span>
<span class="authors__author-name">{{ $authorName }}</span>
{{ end }}
</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 }}">
{{ else }}
{{- partial "icon.html" (dict "icon" "cue" "class" "authors__image") -}}
{{ end }}
<img class="authors__image" src="https://github.com/{{ $authorName }}.png" alt="{{ $authorName|default .Params.name }}">

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

{{ if .Params.name }}
<span class="authors__author-name">{{ .Params.name }}</span>
{{ end }}
</div>
</div>

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

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

<div class="authors__search">
<a class="authors__link" href="/search/?q=author:{{ replace .Name "/index.md" "" }}">
Expand Down

0 comments on commit 3f9d311

Please sign in to comment.