Help with author pages

What page isn’t rendering? I need more context.

What hugo version are you running?

Sorry for the delayed response. The pages render fine @rdwatters but your code renders nothing (like I don’t have any markup). My hugo version is 0.21

Attaching screenshots - Maybe you can see something I am not seeing @rdwatters

This is the frontmatter in a post (I just have one post to rule out issues)

here is my config.toml

here is my _index.md inside /authors/

Here is my single.html

And this is what renders (notice how HELLO WORLD is displayed with nothing in the middle)

@Alan_Roy Can you please put this source somewhere so that I can run it locally? This thread has 44 posts, screenshots, etc, and source could really help consolidate our efforts. Thanks!

Sure @rdwatters , but I have to separate it out from the main project and I may not have time this weekend. I’ll post when I do. Alternatively, if you have a working dummy version up somewhere, I could compare it as well. Much appreciated!

Where can I read this Chemex post? I could certainly use some help with my blooms. :yum:

@Jonathan_Griffin @rdwatters Sorry for bringing this back up. I have been successfully using Jonathan’s single author implementation. I was wondering if there was any development on your ends for multi-author support in the time since we last spoke. I will try to post a repo if needed as well.

Hey Alan, I wrote an extensive tutorial on how to use taxonomies. You can check it out here: Handling taxonomies like a boss - update

Check it out. You can use multiple multiple authors with this approach.

If you still feel confused, I’ll be happy to help you. It will help me to get better with taxonomies. Just point me to your repo.

1 Like

@guayom thank you! I’m so close. Using the code in here (https://github.com/guayom/hugo-taxonomies/blob/master/layouts/partials/brand-list.html), I have been able to list multiple authors per page. However, I have additional frontmatter in each author’s page that I would like to surface on the single and summary layouts, so how would I edit the snippet I linked above to access the field of photoThumb: "/img/team-photos/joe@2x-sm@2x.jpg" inside of joe/_index.md ?

My main objective is to show a photo thumbnail next to the name. My markup (which worked in the single author approach looked like this)

 {{ $postauthor := .Params.authors }}
{{ range where (where .Site.Pages "Type" "authors") ".Params.name" "=" $postauthor }}
<a href="/authors/{{ .Params.name | urlize}}">

<img class="img-circle img-thumb" src="{{ .Params.photoThumb }}">
{{ .Params.firstName }} {{ .Params.lastName }} <!-- {{ .Params.jobtitle }} --></a>
{{ end }}

@guayom to put it in the context of your example repo, it would be the equivalent of surfacing the Adidas Logo inside a single product page, next to the brand name.

Could this be what you’re looking for?

<ul>
  {{ range ($.Site.GetPage "taxonomyTerm" "authors").Pages }}
   <li>
       <a href="{{ .Permalink }}">
         <img class="img-circle img-thumb" src="{{ .Params.photoThumb }}">
         {{ .Params.firstName }} {{ .Params.lastName }} <!-- {{ .Params.jobtitle }} -->
       </a>
   </li>
  {{ end }}
</ul>

@guayom it’s close, but it seems to be posting every author instead of the author that is specified in the post’s frontmatter. I took your code and replaced it with just the first name.

What the… @rdwatters your code works now! I guess I must have done something wrong. Sorry for the confusion! Thanks so much :smiley:

@guayom I am good with Ryan’s code actually, but thank you for your help. Maybe you can integrate this use-case into your other post as well. Very useful and informative.

1 Like

Glad that you got this working! Sorry, I misunderstood the question.
@rdwatters that snippet is great! I was actually looking for a way to do that. I updated my code with yours. Thanks!

1 Like

Unrelated: What editor and font and coloring are you using? Also, is everything in bold?

If you’re asking me, it’s Sublime Text 3, with the Material Theme. And no, I don’t believe so.

@rdwatters I have one last question. Using your method, right now I am compiling a list of authors on the sidebar with the following code -

<h4 class="feature-title">Authors</h4>
  {{ $postauthor := .Params.authors }}
  <div class="small-up-4 row author-selection">
    {{ range (where .Site.Pages "Type" "authors") }}
    <div class="column"><a href="/authors/{{ .Params.name | urlize}}">
      <img alt="{{ .Params.name }}" src="{{ .Params.photoThumb }}">
    </a></div>
    {{ end }}
  </div>

While this works, I am currently displaying all authors, including those who have no posts. Can you think of a way to first check if the author has at least 1 post before adding his face to the sidebar?

Thanks so much!

Trick question! If they aren’t published, they aren’t an author!

In other news, you are going to need to do some gnarly lookups to figure out if an author has posts. Probably easier to just comment out their line in your config, until they are ready to be linked (or chance the author template to show a “No Content Found” message).

What you’re doing seems different than my method. If you treat authors like a taxonomy, it’s easy to only list those authors that have at least one article, since they’d need to be mentioned at least once in order to be used in the list…

Oh you’re right! Sorry, I was using a different snippet. Your suggestion works @rdwatters using this code.

   {{ range first 15 .Site.Taxonomies.authors.ByCount }}
  <li><a href="/authors/{{ .Name | urlize }}">{{ lower .Name }} <span>{{ .Count }}</span></a> </li>
  {{ end }}

How would I extract params.photoThumb, since I need to display the photo and not the name?