Footer partial question

I am new to Hugo and trying to update a theme footer.html partial.

I want to add some text/info to the footer for display, but I only want it to display on my “/about” page. How would I accomplish this?

Method A - Conditional statement

If you’re using the same template for every regular page.

layouts/_default/single.html

...
{{ if eq .Path "/about" }}
  {{ partial "footer.html" . }}
{{ end }}
...

In the above, Path refers to the logical path.

Method B - Unique template

content/about.md

+++
title = 'About'
date = 2024-11-17T15:02:59-08:00
draft = false
layout = 'about'
+++

layouts/_default/about.html

...
{{ partial "footer.html" . }}
...

Thanks. Exactly what I was looking for.

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