How could i generate a sequential unique identifier in the front matter automatically from archetypes?

I am trying to make a sequential unique identification number each time an archetype is used to create a new file. I need in the front matter something like file001, file002, etc. All files will be located in a headless page leaf in content.

I am creating a kind of business directory template, for that I am using front matter as data base to process the info. In this case, each markdown document in a headless page leaf is a register. I need a way to have a form to asign a unique reference number.

Is there a way for Hugo to generate that kind of references in a specific page leaf?

Not currently. You’ll need an separate tool.

Thanks @maiki.
I am gonna still trying with some kinds of scripting.

You could do now.UnixNano (or now.Unix for seconds`) – which would be sequential, but maybe not how you define … sequential.

4 Likes

Thanks @bep.
After all, maybe this is the best option in terms of standardization and simplicity. Also, Is easier change python script that process the info, than putting complex scripts in the archetypes.