Archetypes doesn't work

first of all when I create a post normally (with an empty archetypes directory), hugo doesn’t fill the front matter with title and date.
and when I use archetypes (a very simple md file just like the documentation). hugo still ignores it and generates an empty front matter for me.

I use v0.19 (and tried v0.20-DEV) version of hugo on archlinux

  1. I don’t use Linux so my input will likely be limited
  2. I need more information if this is your first Hugo site
    • How are you creating these files with hugo new?
    • Did you create your archetype in archetypes/post.md
    • Do your archetypes and content directories (i.e., sections) mirror one another? (E.g., hugo new post/my-new-post.md is going to look for archetypes/post.md, then archetypes/default.md, and then Hugo’s internal archetype, which adds title, date, and draft = true—note that only title and date will be inherited by all subsequent archetypes.

Hosted git repos are important, especially if this is an actual bug you’re trying to report so that it can be cloned and tested by maintainers of this project.

as I said I did what the docs said.
I’ve tested with both archetypes/default.md and archetypes/post.md
I’ve created the post with both hugo new post/test.md and hugo new -k post post/test.md
I’ve tested it with different sites (I’ve created sites just to test this issue)
the important thing is that hugo doesn’t generate even default title and date archetype.

the steps to reproduce the bug on a linux distro with go v1.8:

  1. go get github.com/spf13/hugo
  2. hugo new site blog
  3. cd blog
  4. hugo new post/test.md
    [ now content/post/test.md doesn’t have title and date ]
  5. create archetypes/default.md and write a template
  6. hugo new post/test-2.md
    [ again content/post/test-2.md is empty ]
    this will yield the same result with archetypes/post.md

Hi,

I’m not able to recreate the problem using Hugo v0.19 linux/amd64.

Before testing, I made sure I do not have an archetypes/post.md or archetypes/default.md.

However, I’m using a theme, and in my theme folder I do have an archetypes/default.md but it contains only:
+++
+++

When I hugo new post/test.md, it correctly opens my editor with the front matter date and title populated.

The only difference is I’m using hugo installed by npm, rather than downloading the github repo.

1 Like

I opened an issue

@mehdy,

Sorry for the confusion, but this line is insufficient:

go get github.com/spf13/hugo

I have spf13/hugo#3153 on my TODO list (I’ll try to get that fixed today), but here’s the basics:

We use govendor to vendor our library dependencies, but we don’t commit the vendored packages themselves in our git repo. Using go get doesn’t retrieve the vendored dependencies we need. Do this instead:

go get github.com/kardianos/govendor && \
  govendor get github.com/spf13/hugo

Since you likely already have the Hugo sources, you can use the provided Makefile to do the same thing as above with make install.