Help with author pages

Gotcha. Thanks for the update. Frankly, it was my bad for being lazy and not reading the preceding comments :smile:

So here is what I would recommend:

  1. I assume you have author = "authors" in your config.toml under [taxonomies].
  2. I assume, for example, that if you have an author named Ryan Watters, you have a content file for said author at content/authors/ryan-watters/_index.md.
  3. I assume that when you add an author to a content file, you do so using authors = ["Ryan Watters", "John Doe"], etc…

So here is what you need for something like layouts/_default/single.html:

<!--Somewhere in layouts/_default/single.html-->
{{ with .Params.authors }}
      {{ range $ind,$val := . }}
           {{$author := $val | urlize }}
           {{- with $.Site.GetPage "taxonomyTerm" "authors" $author}}
           <p>Name = {{ .Params.name }} </p>
           <p>Bio = {{ .Params.bio }}</p>
           <p>Photo = {{.Params.photo}}</p>
           <p>Here is the content from this author's _index.md file:</p>
          {{.Content}}
      {{ end -}}
  {{ end }}
{{ end }}

Obviously you can use whatever elements you want…

2 Likes