Is this possible to Move Front Matter display?

Hi all, I have a test Hugo site.

I’m curious if I can direct portions of the front matter to be displayed at different locations: For example on my test1 page, I would like the test1, date, and tags to only display in the blue section, as opposed to being in the black section.

Would this be possible?

Hi,
firstly, what you describing is not “front matter” but more “front end” or I will just call design.

Front matter is this in markdown files

---
title: test1
---

You can change whatever you want. Depend on the options of the theme you may do this through theme config or play with HTML and CSS to adjust. Some knowledge required.

Hi Idarek,
Yes I specifically meant front matter, I’m wanting to move where its displayed. If you look at the example I gave, (here)[https://hugo.chrisamoody.com/posts/my-first-post/] it shows the title twice. I want to remove it from showing the second time, and I would like to change where it displays the date.

Could you share your repo please.

Sorry it took so long, you can find it here

Ok, your first issue is in my-first-post.md having double title in frontmatter

---
title: "My First Post"
date: 2023-04-02T22:51:56-05:00
draft: false
tags: ["foo", "bar"]
menu: main
title: test1
parent: test
---

But the problem is in your baseof.html template and this part.

<div id="home-jumbotron" class="jumbotron text-center">
            <h1 class="title">{{ .Title }}</h1>
          </div>
        {{ end }}
        {{ if ne .IsHome true }}
        <div id="content">
        {{- block "main" . }}{{- end }}
        </div>

You calling title in jumbotron and calling Block main again, which will include Title, Date and Content. Normally this will look like that:

<div id="content">
        {{ .Content }}
</div>

To recall only content. and than above this content div you just need to add call for metadata, something like that:

<div id="content">
        {{ partial "metadata.html" . }}
        {{ .Content }}
</div>

Again, nothing to do with frontmatter but theme.

1 Like