Archetypes not properly working in 0.12?

I’m running into an issue where I cannot get archetypes working, when running hugo new showcase/test.md for example I see a EOF error thrown by Hugo.

I have set up this test repository to show exactly what I’ve done, but it is essentially a vanilla installation of Hugo. https://github.com/polds/hugo-archetypes-test

When in that repository running 0.12 running hugo new -v showcase/test.md I see the following output:

INFO: 2015/01/04 Using config file: /private/tmp/test/config.toml
INFO: 2015/01/04 attempting to create  showcase/test.md of showcase
INFO: 2015/01/04 curpath: /private/tmp/test/archetypes/showcase.md
ERROR: 2015/01/04 EOF

Is there something that I am blatantly missing?

Hello @Mteigers,

I did some tests, and finally noticed that archetypes/showcase.md contains no EOL (end-of-line) after the final +++:

+++
somevar = "testing"
+++

Please try adding an EOL at the very end manually, or by changing your editor setting not to strip EOL at the end of the file, and try running hugo new -v showcase/test.md again.

Perhaps Hugo needs to be modified to be able to handle such “[noeol]” files?

That was exactly the issue. Looking back over the documentation I didn't see any indication of needing a new line at the end of a file. Perhaps either adding support for noeol as you mentioned or at least updating the documentation with that note might be worth the trouble?

On Sunday, January 4, 2015, anthonyfok <discuss@gohugo.io> wrote:

anthonyfok January 4

Hello @Mteigers,

I did some tests, and finally noticed that archetypes/showcase.md contains no EOL (end-of-line) after the final +++:

+++
somevar = "testing"
+++

Please try adding an EOL at the very end manually, or by changing your editor setting not to strip EOL at the end of the file, and try running hugo new -v showcase/test.md again.

Perhaps Hugo needs to be modified to be able to handle such "[noeol]" files?

To respond, reply to this email or visit http://discuss.gohugo.io/t/archetypes-not-properly-working-in-0-12/544/2 in your browser.


Previous Replies

Mteigers January 4

I'm running into an issue where I cannot get archetypes working, when running hugo new showcase/test.md for example I see a EOF error thrown by Hugo.

I have set up this test repository to show exactly what I've done, but it is essentially a vanilla installation of Hugo. https://github.com/polds/hugo-archetypes-test

When in that repository running 0.12 running hugo new -v showcase/test.md I see the following output:

INFO: 2015/01/04 Using config file: /private/tmp/test/config.toml
INFO: 2015/01/04 attempting to create  showcase/test.md of showcase
INFO: 2015/01/04 curpath: /private/tmp/test/archetypes/showcase.md
ERROR: 2015/01/04 EOF

Is there something that I am blatantly missing?


To respond, reply to this email or visit http://discuss.gohugo.io/t/archetypes-not-properly-working-in-0-12/544/2 in your browser.

To unsubscribe from these emails, visit your user preferences.

1 Like

I just wasted 20 minutes going WFT until I decided to search the forum. So I agree with @Mteigers at the very least this needs to be in the documentation (asap) and, as commented, have hugo deal with the lack of a last EOL(F) in the next release.

When you shout out about “wasting 20 minutes” and “going WTF” and “this needs to be in the documentation (asap)”, please remember that this is free software, developed by people who do it because they think it’s fun. Some of us “waste” a lot more than 20 minutes doing this.

If you want it in the documentation ASAP, the fastest known way is to do it yourself.

Followup. I consider this a bug so I have added it to the bug topic

Follwup: If you consider it a bug, add an issue to https://github.com/spf13/hugo/issues

This is a forum for discussion, not a bug tracker.

Ok but this is a point of confusion. Why then bother to have a “bug” category here?

@bjornerik I didn’t shout anything. WTF was a question to myself. I have in the past edited the hugo documentation and can do so again. And I have on several occasions thanked Steve and Nate for their work.

To discuss “potential bugs”, not sure - I didn’t pick the labels. If you’re SURE that it’s a bug, go to GitHub.

It’s OK to blow some steam. It was just the “wasted 20 minutes” “must be fixed asap” that bugged me a little. As 20 minutes is a drop in the Open Source sea.

Excellent idea, especially since future code fix cannot help v0.12 users.

A bug report has been filed on GitHub by another “victim” as Issue #776: “hugo new” gives strange EOF error when an archetype file has no final EOL (original title: “Hugo new behaves completely weird”) at:

beside what @anthonyfok added to the troublehooting section I just added this simiple note below to achetype.md and put in a pull request. Hopefullly they can actually update the doc website now and not wait until new hugo release.

NOTE: Some editors (e.g. Sublime) do not insert an EOL at the last line. If you get an EOF error using hugo new type a carriage return after the closing +++ in each archetype file.

1 Like