Skip to content

Commit fd217bc

Browse files
Unify news posts and blog posts, and standardise "authors" vs "author" in frontmatter (#695)
Closes #128; this PR adds author and date icons to news posts. There has been some inconsistency in how authors are mentioned in the YAML frontmatter, which we have standardised with this PR. #### use of `authors: ["foo"]` https://github.com/search?q=%22authors%3A+%5B%22+%28org%3Ascientific-python+OR+repo%3Anumpy%2Fnumpy.org+OR+repo%3Ascipy%2Fscipy.org%29+language%3AMarkdown&type=code #### use of `author: ["foo"]` https://github.com/search?q=%22author%3A+%5B%22+%28org%3Ascientific-python+OR+repo%3Anumpy%2Fnumpy.org+OR+repo%3Ascipy%2Fscipy.org%29+language%3AMarkdown&type=code This PR makes it `authors:` only, which can imply either a single author or multiple authors.
1 parent 5ce2c33 commit fd217bc

File tree

4 files changed

+13
-1
lines changed

4 files changed

+13
-1
lines changed

layouts/news/list.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{{ define "main" }}
2+
{{ partial "posts/list.html" . }}
3+
{{ end }}

layouts/news/single.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{{ define "main" }}
2+
{{ partial "posts/post.html" . }}
3+
{{ end }}

layouts/partials/posts/meta.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
{{- if .Params.Author -}}
2+
{{- errorf "Page %q uses deprecated 'author' field. Please use 'authors' instead." .File.Path -}}
3+
{{- end -}}
14
<div class="post-meta">
25
<span class="post-authors">
3-
{{- range .Params.author -}}
6+
{{- range .Params.Authors -}}
47
{{ $author := trim (index (findRE `[^<]*` . 1) 0) "\n\r " }}
58
{{ $handle := index (index (findRESubmatch `<(.*?)>` . 1) 0) 1 }}
69
<div class="post-author">

layouts/partials/section/section.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ <h5 class="subtitle">{{ .Params.Subtitle }}</h5>
99
{{ .Content }}
1010
{{ else }}
1111
{{ range .Pages }}
12+
{{- if .Params.Author -}}
13+
{{- errorf "Page %q uses deprecated 'author' field. Please use 'authors' instead." .File.Path -}}
14+
{{- end -}}
1215
<div class="post-list">
1316
<article>
1417
<div class="post-title"><a href="{{ .RelPermalink }}">{{ .Title }}</a></div>

0 commit comments

Comments
 (0)