Understanding Hugo archetypes

Hi there,

I do not understand why the below code in archetype doesn’t work?

# archetype name: properties.md
---
title: "{{ replace .Name "-" " " | title }}"
date: "{{ .Date }}"
draft: true
properties: "enum[rent, sale]"
type: "{{ inArray "residential" "commercial" }}"
subtype: "{{ inArray "apartment" "home" "office" "shop" "plot" "land" }}"
---

when running Hugo new it create an empty .md page in the content directory /properties/

Thanks

inArray doesn’t exist as a function.
You probably meant the go function “in_array” ?
but you provide too strings, there must be a mistake. Assuming you do mean in_array, there is no one-to-one correspondance between hugo’s functions and go… thanks Lord. Use the operator in
Also, what is “enum[rent, sale]” supposed to mean ? Again this is Go’s syntax, not hugo’s. you seem to be defining an enumeration type here ? No explicit typing in golang !

Archetypes allow for automated frontmatter creation by interpreting the content of parameters.

Hi @Tom_Durand

I am trying to see if I can create an archetype which at the time of running Hugo new ask me for some extra details for example for properties I can select either rent or sale.

Or the Hugo archetypes are statics and I have to add manually the text? I though since Hugo is build with gaoling it might take some golang code

Is there Hugo archetype cheatsheet which show what else can be added in the Hugo archetypes?

Thanks

STATIC site generator. It doesn’t ask anything. You indicate where to find the information - page, resource, API requests, metadata of a file through os.stats… - and it gets it. Although there are more limitations in frontmatters than on templates due to rendering order I suppose.
Read the manual.

HI @Tom_Durand

I read the documentation it is very basic for example:

---
title: "{{ replace .Name "-" " " | title }}"
date: {{ .Date }}
draft: true
---

**Insert Lead paragraph here.**

## New Cool Posts

{{ range first 10 ( where .Site.RegularPages "Type" "cool" ) }}
* {{ .Title }}
{{ end }}

This is all that I see for the front matter of Hugo there is no more advance tips or tricks for example properties: "enum[rent, sale]" so I wonder if Hugo archetypes are very basic or the community is very small and these features or a detailed documentation on what else can be added in the archetype is not yet covered?

Thanks