In my project it has three level directory just like:
/content/a/b/c
I create /archetypes/c.md and add some content in it
but when I use hugo new /a/b/c/001.md
001.md is used default archetype
I tired to create /archetypes/a/b/c.md
hugo new still use default archetype
please help
I’m not sure if Hugo supports archetypes in 3 levels of sub-directories, but you can pass the -k
/ --kind
flag to the hugo new
command.
- archetypes
- a.md
- b.md
- c.md
hugo new -k c a/b/c/001.md
Hugo uses the upper dir / section to the archetype, Alfrede shows the way to do it
hugo new does NOT copy the complete archetype … (tryed it a longer time ago - can changed now)
Search for it here
I create posts with a script at level 3 - sample script (Windows) - will use post archetype
@echo off
@set /p id=Enter Title:
@set temp=%DATE:.=%
@set title=%id: =_%
@set dirname=%temp:~4,4%-%temp:~2,2%-%temp:~0,2%_%title%
@set year=%temp:~4,4%
hugo new post\%year%\%dirname%\index.md
thanks for replay
I tired use that command when I use -k/–kind/–k flag the help content is listed must use -kind flag can create but archetypes still not work.
(hugo v0.87.0-B0C541E4+extended windows/amd64 BuildDate=2021-08-03T10:57:28Z VendorInfo=gohugoio)
I think either the list directory can be customized, looks like 3 level but actually it is /content/c/
or put c.md’s archetype to correct path example?
thanks for reply
that bat file is nice. can input title manual HAHA. thanks for that. but I tired to change archetype file name to index.md and use that bat command even add -kind flag but the archetype still not work
is my archetype put wrong path?
just now I found out multi-level directory makes template can’t work
content
a
b
c
layout
a
b
c
list.html
if like above example hugo will use layout _default list.html to rander list html
For that you can set layout: list
(or whatever layout you want) in the frontmatter, IIRC.
thanks but I abandon three-level directory back to default structure. because I’m not sure other issus for three-level directory