# Is there any way to have frontmatter metadata for homepage?

**URL:** <https://discourse.gohugo.io/t/is-there-any-way-to-have-frontmatter-metadata-for-homepage/3269>\
**Category:** support\
**Created:** [May 5, 2016, 11:23am UTC](https://discourse.gohugo.io/t/is-there-any-way-to-have-frontmatter-metadata-for-homepage/3269 "2016-05-05T11:23:47Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![rhewitt](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/rhewitt/32/332_2.png) [@rhewitt](https://discourse.gohugo.io/u/rhewitt)\
**Post date:** [May 5, 2016, 11:23am UTC](https://discourse.gohugo.io/t/is-there-any-way-to-have-frontmatter-metadata-for-homepage/3269/1 "2016-05-05T11:23:47Z")

</div>

Since the homepage is handled differently from other site content it appears there’s no way to include homepage specific metadata as frontmatter.

My use case is to maintain a ‘Last updated’ variable in the frontmatter, which is displayed in the footer of each page. I wrote a short [node script](https://github.com/USFWS/southeast/blob/b0f3d1487d04a524bbce87bf62d0f62111057f24/build/last-mod.js) that automatically injects the current date into the frontmatter of content pages when the file (any `.md` or `.html` file in `site/content/`) is saved. The ‘last updated’ information isn’t necessarily a good fit for `.Site.Params` because it applies only to the homepage.

I suppose I can write another script that injects the date directly into the footer of the homepage, but surely my use case isn’t the only one for needing homepage metadata.

---

<div class="post-metadata">

**Author:** ![digitalcraftsman](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/digitalcraftsman/32/4142_2.png) [@digitalcraftsman](https://discourse.gohugo.io/u/digitalcraftsman)\
**Post date:** [May 5, 2016, 11:42am UTC](https://discourse.gohugo.io/t/is-there-any-way-to-have-frontmatter-metadata-for-homepage/3269/2 "2016-05-05T11:42:42Z")

</div>

Hugo already provides a variable that stores the last modification date of the document that is used to build a page:

```auto
This page was last modified at {{ .Lastmod }}

```

---

<div class="post-metadata">

**Author:** ![rhewitt](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/rhewitt/32/332_2.png) [@rhewitt](https://discourse.gohugo.io/u/rhewitt)\
**Post date:** [May 5, 2016, 12:43pm UTC](https://discourse.gohugo.io/t/is-there-any-way-to-have-frontmatter-metadata-for-homepage/3269/3 "2016-05-05T12:43:06Z")

</div>

I added the following to my template `{{ .Lastmod.Format "2006-01-02" }}`, which yeilds `0001-01-01`.

Do I need to tell hugo where I am (timezone?) to get an accurate time?

---

<div class="post-metadata">

**Author:** ![digitalcraftsman](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/digitalcraftsman/32/4142_2.png) [@digitalcraftsman](https://discourse.gohugo.io/u/digitalcraftsman)\
**Post date:** [May 5, 2016, 1:37pm UTC](https://discourse.gohugo.io/t/is-there-any-way-to-have-frontmatter-metadata-for-homepage/3269/4 "2016-05-05T13:37:53Z")

</div>

I found your script in [this thread](https://discuss.gohugo.io/t/method-to-automate-last-modified-date/970/3). After having a look at the [corresponding issue](https://github.com/spf13/hugo/issues/733) it seems to default to the `date` value in the frontmatter and you’ve to overwrite it with the `lastmod` manually.

Since a content change of a file doesn’t affect `lastmod` I wouldn’t know how to access the last real modification date inside a template.

---

<div class="post-metadata">

**Author:** ![rdwatters](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/rdwatters/32/2848_2.png) [@rdwatters](https://discourse.gohugo.io/u/rdwatters)\
**Post date:** [May 5, 2016, 7:06pm UTC](https://discourse.gohugo.io/t/is-there-any-way-to-have-frontmatter-metadata-for-homepage/3269/5 "2016-05-05T19:06:07Z")

</div>

@rhewitt Are you trying to do this at the page-level? If it’s across the site, see the thread here that @bep helped me with a short while back:

> **[.Site.LastChange stopped working?](https://discourse.gohugo.io/t/site-lastchange-stopped-working/2827)**
>
> I have tried the following in a partial called site\_copyright.html: © {{ .Site.LastChange.Format "2006" }} {{ if .Site.Params.CopyrightLine }}{{.Site.Copyright}}{{ end }} And then…

---

<div class="post-metadata">

**Author:** ![rhewitt](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/rhewitt/32/332_2.png) [@rhewitt](https://discourse.gohugo.io/u/rhewitt)\
**Post date:** [May 9, 2016, 6:32pm UTC](https://discourse.gohugo.io/t/is-there-any-way-to-have-frontmatter-metadata-for-homepage/3269/6 "2016-05-09T18:32:56Z")

</div>

@rdwatters

Yes, I’m trying to achieve this on a page-by-page basis (when was the content edited last rather than when was the site built last).
