hugo-academic-cli bibtex import is broken with hugo v0.89.0
ostaadt opened this issue · comments
academic import --bibtex publications.bib
is creating a malformed path for markown_path
in parse_bibtex_entry
, which is defined in academic/import_bibtex.py
.
markdown_path
starts with content/...
, but the subprocess call to hugo new {markdown_path} --kind publication }
already prepends the path with content
automatically.
BibTeX entries are parsed correctly, and cite.bib
is created in the correct directory (e.g., content/publication/some-publication-id/cite.bib
). The markdown entry, however, is created in content/content/publication/some-publication-id/index.md
. Subsequently, parse_bibtex_entry
throws an error, because it cannot find index.md
in content/publication/some-publication-id
.
I don't know if this a bug in hugo new --publication
or a change in archetypes behavior in the latest hugo
I was able to fix the problem in academic
by changing markdown_path
from
markdown_path = os.path.join(bundle_path, "index.md")
to
markdown_path = f"{pub_dir}/{slugify(entry['ID'])}/index.md"
This fix works for hugo v.0.89.0, but it might break older versions...
confirmed as having the same issue; haven't tried the fix yet
Hugo v.0.89 is a new release with major changes. There are often bugs in the very latest major Hugo versions. Consider reporting Hugo bugs in the Hugo repo so that the relevant team are aware of them and can help address them...Or better yet, help contribute a Hugo fix since it's also an open source initiative that's driven by the community ;)
In this case, it appears the Hugo 0.89.0 CLI bugs were fixed in Hugo 0.89.4 (e.g. gohugoio/hugo#9177).
With Hugo 0.89.4, the command you referred to, hugo new content/publication/test/index.md --kind publication
, works fine.