Content adapter: Set featured image per category

This is a modified version of the example site from the topic you referenced. It requires Hugo v0.146.0 or later.

git clone --single-branch -b hugo-forum-topic-54852 https://github.com/jmooring/hugo-testing hugo-forum-topic-54852
cd hugo-forum-topic-54852
hugo server

The content adapter creates a page for each product, and zero or more page resources for each product (i.e., images in this case).

The term page loops through all pages with the given term until it finds one with an image. That image is then displayed on the term page.

Files of interest:

  • content/products/_content.gotmpl
  • layouts/products/page.html
  • layouts/term.html

EDIT 2026-03-27T08:29:19-07:00: The example now requires v0.159.0 or later.

4 Likes