Attaching Expired Authors to Posts?

I have a Hugo site with a few hundred posts and each post is associated with an author custom taxonomy. The authors have their own list and single page, but when they leave the company their author page is marked as expired to remove them from these list and single pages.

I was wondering if it’s possible to have an Author marked as expired still attached to a post at render, without having their own single and list page?

1 Like

We can’t tell how you’re rendering these without a look at your code. If you could please have a look at Requesting Help and provide some more details? Thanks.

Sorry! I was after more general advice but I can see now that might be easier with an example.

I have duplicated my repo here:
https://github.com/guyaldous1/hugo-example

Basically, I want to utilise the author ‘migrationagents’ taxonomy in the ‘migration-news’ layout in a similar manner to ‘case-studies/single.html’ layout (example below). However I want it to include ‘migrationagents’ that are expired.

{{- range .Params.migrationagents }}
{{- with $.Site.GetPage "taxonomyTerm" (printf "migrationagents/%s.md" (urlize .)) }}
          {{ $agentimg := .Params.agentimg }}
<li>
	<a href="{{.RelPermalink}}">
		<div class="img"></div>
			<img src="{{$agentimg}}" alt="{{.Title}}">
		<div class="cs-detail-agent">{{.Params.firstname}}<br/>{{.Params.lastname}}</div>
	</a>
</li>
      {{end}}
{{end}}

This is a similar issue (how to get some front matter data from a draft page when building a site).

basically: you could read the directory that your authors are in and use transform.Unmarshal on .Content to create a map to extract parameters from.

BUT
now after taking a second look at your text, you are linking to the author page… so you still want that page to render… so i think that you are using expired wrongly. but it seems like you can use --buildExpired on build (see: Basic usage | Hugo)

Thanks for the reply Henry.

I think maybe the transform.unmarshal will work for me. I don’t want to render the expired pages, but I want to pull names and images of authors who are no longer employed by the business.