[Content / Theme Customisation] - Adding two pieces of content to each post

Hi all,

Using ‘black-and-light’ theme, want to add two pieces of content to each post, which is displayed on homepage (GitHub - davidhampgonsalves/hugo-black-and-light-theme).

Ideally I’d want each post to look like this:

Title (as is in theme)
One sentence text (not the first line of the article)
Another short sentence text
Date

e.g.

Title Post
Subtitle one with some text specific to the post
Subtitle two with some text specific to the post
2nd August 2023

Any advice on how I would start to tackle this would be most appreciated. Thanks.

mkdir -p layouts
cp themes/bw/layouts/index.html layouts/

Then edit layouts/index.html, inserting the two div elements below.

<h2><a href="{{ .Permalink }}">{{ .Title }}</a></h2>
<div>{{ .Params.subtitle_1 | .Page.RenderString }}</div>
<div>{{ .Params.subtitle_2 | .Page.RenderString }}</div>
<div class=date>

Then in your content front matter:

---
title: "Post 01"
date: 2023-08-02T15:49:30-07:00
draft: false
subtitle_1: Able was I **ere** I saw Elba
subtitle_2: A man, a **plan**, a canal -- Panama
---

This worked. Thank you!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.