Last Modified Date with Hugo

I want to have a last modification date on some of my sites. I found this link for last modified and I tried to implement this in my page. What I do wrong? Please take a look on the screen shot.

I have in the hugo.toml

enableGitInfo = true

  date = ["date", "publishDate", "lastmod"]
  lastmod = ["lastmod", ":git", "date", "publishDate"]

In the

title: "Handbook"
description: "Handbook"
draft: false
slug: handbook

# <u>Handbook</u>

Last Modified: {{ .Lastmod.Format "2 January 2006" }}

## General


Place content in content files.
Place template code in template files.

I wrote this into the single.html It worked.

{{ define "main" }}
<div class="container">
	<div class="row">
		<div class="col p-4">
			{{ .Content }}
			{{ $published := .PublishDate | time.Format ":date_medium" }}
			{{ $modified := .Lastmod | time.Format ":date_medium" }}

			{{ if ne $published $modified }}
			<span> Last modified: {{ $modified }} </span>
			{{ end }}
{{ end }}