Archetype rework in 0.89(.0/2/3) breaks hugo new

Since the archetype rework in 0.89 my hugo new throws (various differing) errors.

The archetype (in archetypes/blog/index.md):

+++
title = "{{ replace .Name "-" " " | title }}"
linkTitle = "{{ replace .Name "-" " " | title }}"
# used for SEO description, should not go over 180 characters
description = ""
# used for the preview of the post on list pages
# if missing or empty the automatic excerpt is used
summary = ""

# dates
date = {{ .Date }}
publishDate = {{ .Date }}
lastmod = {{ .Date }}

# add multiple resources to create a slider gallery
[[resources]]
title = "Photo by [Ave Calvar](https://unsplash.com/@shotbyrain) via [Unsplash](https://unsplash.com/s/photos/horizon)"
name = "image name if other than src"
src = "ave-calvar-HcUDHJfd5GY-unsplash.jpg"

# remove the author section to use the sites author setup
[author]
name = "Patrick Kollitsch"
homepage = "https://kollitsch.de/"
image = "/images/patrick-kollitsch.jpg"
email = "patrick@kollitsch.de"

# taxonomification
categories = [
  "category1"
]
tags = [
  "tag1", 
  "tag2"
]
keywords = [
  "keyword1", 
  "keyword2"
]
+++

with GoHugo 0.89.0:

patrick@main:~/Projects/dnb-org/kollitsch.de$ hugo new blog/2021/hyper-shell
Error: mkdir /tmp/hugo_cache/modules/filecache/modules/pkg/mod/github.com/dnb-org/libraries/heroicons@v1.0.3/content/blog: permission denied

(note, that GoHugo tries to create the post inside of a module-cache)

with GoHugo 0.89.2:

patrick@main:~/Projects/dnb-org/kollitsch.de$ hugo new blog/2021/hyper-shell
Error: open : no such file or directory

with GoHugo 0.89.3:

patrick@main:~/Projects/dnb-org/kollitsch.de$ hugo new blog/2021/hyper-shell
Error: could not determine content directory for "blog/2021/hyper-shell"

downgrading to GoHugo 0.88.1 solves the issue and the post is created.

patrick@main:~/Projects/dnb-org/kollitsch.de$ hugo new blog/2021/hyper-shell
/home/patrick/Projects/dnb-org/kollitsch.de/content/blog/2021/hyper-shell created

The repo is public in case anybody wants to try their luck.

1 Like

Once I figured out you were using things like archetypes/default/index.md instead of archetypes/default.md I tried:

hugo new /blog/2021/hyper-shell/index.md

and got

WARN 2021/11/16 12:44:34 Module "github.com/dnb-org/components/functions" is not compatible with this Hugo version; run "hugo mod graph" for more information.
WARN 2021/11/16 12:44:34 Module "github.com/dnb-org/components/giscus" is not compatible with this Hugo version; run "hugo mod graph" for more information.
WARN 2021/11/16 12:44:34 Module "github.com/dnb-org/components/netlification" is not compatible with this Hugo version; run "hugo mod graph" for more information.
WARN 2021/11/16 12:44:34 Module "github.com/dnb-org/shortcodes/collection" is not compatible with this Hugo version; run "hugo mod graph" for more information.
WARN 2021/11/16 12:44:34 Module "github.com/dnb-org/shortcodes/youtube" is not compatible with this Hugo version; run "hugo mod graph" for more information.
WARN 2021/11/16 12:44:34 Module "github.com/dnb-org/shortcodes/pictures" is not compatible with this Hugo version; run "hugo mod graph" for more information.
Error: from config: failed to resolve output format "security" from site config

It looks to me like the use of directories for config and archetypes is confusing the new archetype code.

Oh, hugo version: hugo v0.89.3-C88CDB56 linux/amd64 BuildDate=2021-11-15T12:17:46Z VendorInfo=gohugoio

Scratch that; it’s occurring for me independent of use of directories for archetypes and config. (But haven’t yet got a public repo to show).

EDIT:

With my repo at

https://github.com/danielfdickinson/hugo-mounted-content-subdir-bug-0-89.git

and rm -rf archetypes (so that it uses the theme archetypes):

I get the same error as

Which is to say it works if I first do hugo mod vendor, but if I don’t I get:

hugo new content/test-docs/test2.md
hugo: collected modules in 1696 ms
Error: could not determine content directory for "content/test-docs/test2.md"

OR

hugo new test-docs/test2.md
Error: could not determine content directory for "test-docs/test2.md"

EDIT: I wonder if Go has changed something that affects the vfs?

@bep What is the best way to capture the info for an issue report on GitHub?

2 Likes

The issue was fixed with the release of:

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.