Skip to content

Commit

Permalink
Add author name to blog posts
Browse files Browse the repository at this point in the history
Signed-off-by: lucperkins <[email protected]>
  • Loading branch information
lucperkins committed Nov 8, 2019
1 parent f5749b0 commit da1ba30
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 5 deletions.
2 changes: 1 addition & 1 deletion assets/sass/style.sass
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ $family-code: "{{ $monospaceFont }}", monospace
$dashboard-panel-padding: 2rem 1.25rem 5rem 1.25rem
$dashboard-panel-header-bottom-margin: 1.5rem
$dashboard-panel-footer-top-margin: 3rem
$section-padding: 2rem
$section-padding: 3rem 2rem
$navbar-height: 5rem
$navbar-item-img-max-height: $navbar-height * 0.5

Expand Down
2 changes: 2 additions & 0 deletions content/blog/first-post.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
title: First post
date: 2019-12-01
authors:
- name: Luc Perkins
---

Here is some blog post text.
11 changes: 11 additions & 0 deletions layouts/blog/single.en.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
{{ end }}

{{ define "main" }}
{{ $authors := .Params.authors }}
<main class="main">
{{ partial "blog/navbar.html" . }}
{{ partial "blog/hero.html" . }}
Expand All @@ -16,6 +17,16 @@
</a>
</p>

{{ with $authors }}
{{ $numAuthors := len . }}
<p class="subtitle is-size-4 is-size-5-mobile">
{{ range $idx, $author := . }}
{{ $isLast := eq (add 1 $idx) $numAuthors }}
{{ $author.name }}{{ if not $isLast }}, {{ end }}
{{ end }}
</p>
{{ end }}

{{ with .Date }}
{{ $date := dateFormat "January 2, 2006" . }}
<p class="subtitle is-size-5 is-size-6-mobile">
Expand Down
19 changes: 15 additions & 4 deletions layouts/partials/blog/posts.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,29 @@
<div class="columns">
<div class="column">
{{ range $idx, $post := $posts }}
{{ $isLast := eq (add 1 $idx) $num }}
{{ $isLast := eq (add 1 $idx) $num }}
{{ $authors := .Params.authors }}
<article class="blog-article">
<header class="blog-header">
<p class="title is-size-2 is-size-3-mobile has-text-weight-light{{ if .Date }} is-spaced{{ end }}">
<p class="title is-size-2 is-size-3-mobile has-text-weight-light{{ if $authors }} is-spaced{{ end }}">
<a href="{{ .RelPermalink }}">
{{ $post.Title }}
</a>
</p>

{{ with $authors }}
{{ $numAuthors := len . }}
<p class="subtitle is-size-4 is-size-5-mobile">
{{ range $idx, $author := . }}
{{ $isLast := eq (add 1 $idx) $numAuthors }}
{{ $author.name }}{{ if not $isLast }}, {{ end }}
{{ end }}
</p>
{{ end }}

{{ with $post.Date }}
{{ $date := dateFormat "January 2, 2006" . }}
<p class="subtitle is-size-5 is-size-6-mobile">
<p class="is-size-5 is-size-6-mobile">
{{ $date }}
</p>
{{ end }}
Expand All @@ -35,7 +46,7 @@
{{ end }}
</div>

<div class="column is-one-third is-hidden-touch">
<div class="column is-one-quarter is-hidden-touch">
<p class="title is-size-3 is-size-4-mobile has-text-weight-bold">
Posts
</p>
Expand Down

0 comments on commit da1ba30

Please sign in to comment.