Different meta infomation for list pages

Hi

I am wondering if its possible, if there is a bit of code that will specify if a url is used then display some content.

What i mean is, we have the code {{ if .IsHome -}} which displays info from the home page

What if I wanted to display different meta for a top level list page such as portfolio, which would differ from the home page. An else statement wont work in this page. I need to it to be exact url based.

To make it clearer. I want to add open graph tags and other stuff that is ONLY for a list template in a particular url and not displayed anywhere else.

Thanks!

You can test the page’s .Permalink value: {{ if eq .Permalink "some/url/" }}

You can also use different layout files: https://gohugo.io/templates/lookup-order/

2 Likes

Put a layout value in the frontmatter of the markdown file

layout = "portfolio"

copy the used single.html to portfolio.html and modify it.

1 Like