Wondering what I’m misunderstanding here, OR how to accomplish getting the frontmatter to:
content/machine/machine-name/index.html
I created an archetype called machine.md with a lot of extra front matter and thought that it would apply to any hugo new machine/machine-name/index.html that I created – but all I get is the default.md archetype in those index.html files.
Thanks for any help!
EDIT: Would I be correct in assuming that if I put that “machine.md” archetype in archetype/machine/default.md that it would then work for content/machine/machine-name/index.md ?
NOPE that does not work.
Appreciate the response, but I found the answer on page 149 of the “Hugo in Action” book.
I will outline the steps here, for anyone finding thread this via search.
First, create a subfolder & file:
archetypes/machine/index.md (I believe that this must be named index.md)
Fill out the index.md with all of the front matter and page matter that you want generated for each “machine” page you will be creating.
Now, to create a page bundle (folder) named “machine-name1” (resulting in a file: content/machine/machine-name/index.md ) you enter this command:
hugo new machine/machine-name1 --kind machine
NOTE that there is NO .md in the command above. The magic of calling the specified archetype file is accomplished with the --kind machine flag at the end of the hugo new command.
The page bundle folder of /machine-name1/ and associated /machine-name1/index.md are created with the front matter you specified in archetypes/machine/index.md
Now I can store the images associated with machine-name1 in that folder for Hugo processing, etc.
PS… I believe Examples, like this would be very helpful in the documentation pages. I believe that my example could go under the Directory-Based Archetypes section of: Archetypes | Hugo
I don’t have a lot of archetypes. Therefore, it is easier to do hugo new -k machine section/nested-section/file-name.md with -k being kind and machine.md being the file in archetypes folder. I just swap out the archetype name depending on the structure I need. I also stumbled upon the same problem with archetype based folders and gave up on using them.
I don’t understand this line of your response.
Googling for “tree archetypes” brings up nothing and searching for “tree archetypes” shows no uses of that phrase, but does link to the archetypes page, which I already referenced.
I believe now that I have my example working, I can go back and make sense out of the “Directory-Based Archetypes”. However it does not use the term “page bundle” anywhere. It does use “post-bundle” which may mean the same thing, but not sure.
One annoyance with Hugo is that it uses words in it’s terminology that may mean something specific or may not when used in a sentence: type, kind, page (for example). As I like to say, “words mean things” and if a word can be taken in more than one way it introduces the likelihood for confusion (at least until one learns to recognize the context in which it is used). Programming projects might do well to include a non-programmer linguist to assist in the words used to describe things like this.