How could use Unix function in content front matter?

Hi guys:

I want use the .Date.Unix function build identifier flag in every content file’s front matter, then try use string formatter funciton still failure, and it throws an exception message like below :

Error: failed to execute archetype template: template: archetype.md:3:25: executing "archetype.md" at <.now.Unix>: can't evaluate field now in type *hugolib.archetypeFileData: template: archetype.md:3:25: executing "archetype.md" at <.now.Unix>: can't evaluate field now in type *hugolib.archetypeFileData

my archtype front matter template is :

---
title: "{{ .TranslationBaseName | title }}"
identifier: "{{ string (.now.Unix) }}"
date: "{{ .Date }}"
draft: true
categories:
 - "xx"
tags:
 - "xxx"
 - "xxx"
toc: true
---

So what can I do next step, Thanks.

it’s now function combined with .Unix method.

now.Unix (without the dot . prefix)

2 Likes

Thanks, It’s working now.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.