# .Page.Lastmod always show today's date in deployed site (not the last mod date)

**URL:** <https://discourse.gohugo.io/t/page-lastmod-always-show-todays-date-in-deployed-site-not-the-last-mod-date/33576>\
**Category:** support\
**Created:** [June 27, 2021, 3:45pm UTC](https://discourse.gohugo.io/t/page-lastmod-always-show-todays-date-in-deployed-site-not-the-last-mod-date/33576 "2021-06-27T15:45:44Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![justshipit](https://avatars.discourse-cdn.com/v4/letter/j/e56c9b/32.png) [@justshipit](https://discourse.gohugo.io/u/justshipit)\
**Post date:** [June 27, 2021, 3:45pm UTC](https://discourse.gohugo.io/t/page-lastmod-always-show-todays-date-in-deployed-site-not-the-last-mod-date/33576/1 "2021-06-27T15:45:44Z")

</div>

In my single blog page, I have in html: `Last updated: {{ .Page.Lastmod.Format "Jan 2, 2006" | safeHTMLAttr }}` and this shows on my local machine the correct last modified date of the given blog post.

However, when I deploy my Hugo site to the server (with `hugo --cleanDestinationDir --gc --minify`) the last modified date for ALL the blog posts shows today’s date (I assume this is a date of deployment).

Why does this happen? How can I show the correct last modified date on my deployed live Hugo site?

---

<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:** [June 27, 2021, 3:53pm UTC](https://discourse.gohugo.io/t/page-lastmod-always-show-todays-date-in-deployed-site-not-the-last-mod-date/33576/2 "2021-06-27T15:53:45Z")

</div>

1. Please post your site configuration file.
2. Please describe how you deploy to your live site.

---

<div class="post-metadata">

**Author:** ![justshipit](https://avatars.discourse-cdn.com/v4/letter/j/e56c9b/32.png) [@justshipit](https://discourse.gohugo.io/u/justshipit)\
**Post date:** [June 27, 2021, 4:38pm UTC](https://discourse.gohugo.io/t/page-lastmod-always-show-todays-date-in-deployed-site-not-the-last-mod-date/33576/3 "2021-06-27T16:38:08Z")

</div>

hello @jmooring ! Here are the details:

```auto
pygmentsCodefences: true
pygmentsStyle: vs
baseURL: "https://XXXXXXXX.com"
languageCode: en-us
title: XXXXXXXX
favicon: "images/favicon"
defaultContentLanguage: en
defaultContentLanguageInSubdir: false
enableRobotsTXT: true
enableGitInfo: true
disableLanguages: []
disableKinds: ["RSS"]
summarylength: "2"
permalinks:
  blog: "/:slug/"
  categories: "/category/:slug/"
  tags: "/tags/:slug/"
taxonomies:
  tag: tags
  category: categories
  # author: authors
frontmatter:
  date:
  - date
  - publishDate
  - lastmod
  expiryDate:
  - expiryDate
  lastmod:
  - lastmod
  - :fileModTime
  - :default
  publishDate:
  - date
  - publishDate
languages:
  en:
    weight: 1
    languageCode: en
    contentDir: content/en
    languageName: "English"
    hasCJKLanguage: false
    paginate: 12
  es:
    weight: 2
    languageCode: es
    contentDir: c ontent/es
    languageName: "Español"
    hasCJKLanguage: false
    paginate: 12

## misc
# googleAnalytics: UA-xxx # {{ template "_internal/google_analytics_async.html" . }}

build:
  writeStats: true

```

Deployment:

1. I git commit to a master branch on Gitlab
2. Any commit to `master` branch will trigger the webhook to send `POST https://api.render.com/hooks/gitlab` request.
3. Render server receives the POST request and auto deploys with this build command `hugo --cleanDestinationDir --gc --minify` to `public` directory.

---

<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:** [June 27, 2021, 4:46pm UTC](https://discourse.gohugo.io/t/page-lastmod-always-show-todays-date-in-deployed-site-not-the-last-mod-date/33576/4 "2021-06-27T16:46:58Z")

</div>

You have this:

```auto
enableGitInfo: true

```

and this:

```auto
 lastmod:
  - lastmod
  - :fileModTime
  - :default

```

I think you want something like this:

```auto
  lastmod:
  - :git
  - lastmod
  - date
  - publishDate

```

Or just remove that section because that is the default anyway.

See [https://gohugo.io/getting-started/configuration/#configure-dates](https://gohugo.io/getting-started/configuration/#configure-dates)

---

<div class="post-metadata">

**Author:** ![justshipit](https://avatars.discourse-cdn.com/v4/letter/j/e56c9b/32.png) [@justshipit](https://discourse.gohugo.io/u/justshipit)\
**Post date:** [June 27, 2021, 6:39pm UTC](https://discourse.gohugo.io/t/page-lastmod-always-show-todays-date-in-deployed-site-not-the-last-mod-date/33576/5 "2021-06-27T18:39:05Z")

</div>

Hello @jmooring.  
As you can see I already have `enableGitInfo: true` in my config file.

I tried both options, altering my lastmod section and removing it completely from config file - still the deployed date always shows as today.

I am really confused why it works on my local machine but not when I deploy live.

---

<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:** [June 27, 2021, 7:27pm UTC](https://discourse.gohugo.io/t/page-lastmod-always-show-todays-date-in-deployed-site-not-the-last-mod-date/33576/6 "2021-06-27T19:27:53Z")

</div>

Did you create your own deployment pipeline, or are you using an existing CI/CD method (e.g., GitHub, GitLab, Netlify)?

> [@justshipit](#):
>
> The hook on the server watches for changes in repo

Is it looking at a specific directory, or the entire repository?

> [@justshipit](#):
>
> he pulls the content

What does this mean? Git pull, git clone, rsync?

---

<div class="post-metadata">

**Author:** ![justshipit](https://avatars.discourse-cdn.com/v4/letter/j/e56c9b/32.png) [@justshipit](https://discourse.gohugo.io/u/justshipit)\
**Post date:** [June 28, 2021, 2:38am UTC](https://discourse.gohugo.io/t/page-lastmod-always-show-todays-date-in-deployed-site-not-the-last-mod-date/33576/7 "2021-06-28T02:38:52Z")

</div>

@jmooring apologies for not sharing enough details. I redacted my message earlier and also including more detailed info here:

1. I git commit to a master branch on Gitlab
2. Any commit to `master` branch will trigger the webhook to send `POST https://api.render.com/hooks/gitlab` request.
3. Render server receives the POST request and auto deploys with this build command `hugo --cleanDestinationDir --gc --minify` to `public` directory.

---

<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:** [June 28, 2021, 6:34am UTC](https://discourse.gohugo.io/t/page-lastmod-always-show-todays-date-in-deployed-site-not-the-last-mod-date/33576/8 "2021-06-28T06:34:41Z")

</div>

Earlier I asked you to modify or eliminate the lastmod section of your site configuration file.

1. If you have multiple configuration files, did you make the change to all of them?
2. Did you push the changed file(s) to your GitLab repository?
3. Are you sure the webhook fired?
4. Are you sure that hugo was run on [render.com](http://render.com)?
5. Did you know that `cleanDestinationDir` does not delete files in `public` if you don’t have a `static` directory?

---

<div class="post-metadata">

**Author:** ![justshipit](https://avatars.discourse-cdn.com/v4/letter/j/e56c9b/32.png) [@justshipit](https://discourse.gohugo.io/u/justshipit)\
**Post date:** [June 28, 2021, 10:40am UTC](https://discourse.gohugo.io/t/page-lastmod-always-show-todays-date-in-deployed-site-not-the-last-mod-date/33576/9 "2021-06-28T10:40:54Z")

</div>

**1. If you have multiple configuration files, did you make the change to all of them?**  
I only have **one** `config.yaml` in root of my Hugo site and I applied the changes to it & then tested.

**2. Did you push the changed file(s) to your GitLab repository?**  
Yes, the file is always commited as its part of git repo (its **not** in `.gitignore` file).

**3. Are you sure the webhook fired?**  
Yes, I can clearly see in GitLab dashboard the webhooks firing normally. I can also see all the code changes I made on the live site, whether is content or styling/DOM structure.

**4. Are you sure that hugo was run on [render.com](http://render.com)?**  
Yes, everytime I run git push, after the webook fires, I can see in Render’s dashboard the log output of the console. Here is an example output:

```auto
Jun 28 06:36:47 PM ==> Cloning from https://gitlab.com/__misc/REDACTEDREPO...
Jun 28 06:36:48 PM ==> Checking out commit XXXXXXXXbdcea5dcXXXXXXX1 in branch master
Jun 28 06:37:02 PM ==> Downloading cache...
Jun 28 06:37:08 PM ==> Downloaded 29MB in 3s. Extraction took 1s.
Jun 28 06:37:11 PM ==> Installing dependencies with Yarn...
Jun 28 06:37:12 PM yarn install v1.22.10
Jun 28 06:37:12 PM warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
Jun 28 06:37:12 PM [1/4] Resolving packages...
Jun 28 06:37:12 PM [2/4] Fetching packages...
Jun 28 06:37:12 PM info fsevents@2.3.2: The platform "linux" is incompatible with this module.
Jun 28 06:37:12 PM info "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation.
Jun 28 06:37:12 PM [3/4] Linking dependencies...
Jun 28 06:37:14 PM [4/4] Building fresh packages...
Jun 28 06:37:14 PM Done in 1.97s.
Jun 28 06:37:24 PM ==> Using Python version: 3.7.10
Jun 28 06:37:26 PM ==> Running build command 'hugo --cleanDestinationDir --gc --minify'...
Jun 28 06:37:39 PM  
Jun 28 06:37:39 PM Total in 12008 ms
Jun 28 06:37:53 PM ==> Uploading build...

```

**5. Did you know that `cleanDestinationDir` does not delete files in `public` if you don’t have a `static` directory?**  
I was expecting it will delete any directory that is appointed as the destination. Neverthless, I am 100% sure the code changes are being deployed because every other change I introduce is reflected on the live site.

---

<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:** [June 28, 2021, 1:26pm UTC](https://discourse.gohugo.io/t/page-lastmod-always-show-todays-date-in-deployed-site-not-the-last-mod-date/33576/10 "2021-06-28T13:26:57Z")

</div>

It sounds like you have configured everything correctly. A couple of thoughts:

1. Reach out to [render.com](http://render.com) for assistance.
2. Share your repository (privately if you wish) so that I can attempt to reproduce the issue.

---

<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:** [June 29, 2021, 3:12pm UTC](https://discourse.gohugo.io/t/page-lastmod-always-show-todays-date-in-deployed-site-not-the-last-mod-date/33576/11 "2021-06-29T15:12:43Z")

</div>

Related topic:  
[https://community.render.com/t/1999](https://community.render.com/t/1999)

---

<div class="post-metadata">

**Author:** ![justshipit](https://avatars.discourse-cdn.com/v4/letter/j/e56c9b/32.png) [@justshipit](https://discourse.gohugo.io/u/justshipit)\
**Post date:** [July 5, 2021, 4:48pm UTC](https://discourse.gohugo.io/t/page-lastmod-always-show-todays-date-in-deployed-site-not-the-last-mod-date/33576/12 "2021-07-05T16:48:55Z")

</div>

@jmooring Yup that’s mine thread and seems like they cant find the reason too. Please allow me to prepare a repo+server so you can have an env to test with same conditions.
