# Last Modified Date with Hugo

**URL:** <https://discourse.gohugo.io/t/last-modified-date-with-hugo/49044>\
**Category:** support\
**Created:** [March 25, 2024, 12:36pm UTC](https://discourse.gohugo.io/t/last-modified-date-with-hugo/49044 "2024-03-25T12:36:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joerg](https://avatars.discourse-cdn.com/v4/letter/j/49beb7/32.png) [@Joerg](https://discourse.gohugo.io/u/Joerg)\
**Post date:** [March 25, 2024, 12:36pm UTC](https://discourse.gohugo.io/t/last-modified-date-with-hugo/49044/1 "2024-03-25T12:36:11Z")

</div>

I want to have a last modification date on some of my sites. I found this link [https://www.andrewjstevens.com/posts/2021/03/last-modified-date-with-hugo/](https://www.andrewjstevens.com/posts/2021/03/last-modified-date-with-hugo/) for last modified and I tried to implement this in my handbook.md page. What I do wrong? Please take a look on the screen shot.

I have in the hugo.toml

```auto

enableGitInfo = true

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

```

In the handbook.md

```auto

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

# <u>Handbook</u>

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

## General

```

![IMG](https://canada1.discourse-cdn.com/flex036/uploads/gohugo/original/3X/0/e/0ef386c0db52f58ff65bf40c663627cfb3b62e9d.png)

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [March 25, 2024, 12:42pm UTC](https://discourse.gohugo.io/t/last-modified-date-with-hugo/49044/2 "2024-03-25T12:42:14Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Joerg](https://avatars.discourse-cdn.com/v4/letter/j/49beb7/32.png) [@Joerg](https://discourse.gohugo.io/u/Joerg)\
**Post date:** [March 25, 2024, 1:19pm UTC](https://discourse.gohugo.io/t/last-modified-date-with-hugo/49044/3 "2024-03-25T13:19:29Z")

</div>

I wrote this into the single.html It worked.

```auto
{{ 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 }}
		</div>
	</div>
</div>
{{ end }}

```
