The head partial doesn exists. Also the index.html template doesnβt define main. In my opinion the generation of a new theme is incomplete, because I expect when I use a generator that it works out of the box and I can start customizing instead of repairing. Should I send a PR for this?
I wanted to point out the hugo new theme βwill scaffold the beginnings of a new theme for you to get you on your way.β It isnβt a generator. But that is the point, as we want generators to be opinionated and solve a lot of pain points for a use case. The problem Hugo is solving is helping new folks learn about the basic practice of constructing a theme.
Currently, Hugo is geared for people that build web things. A theme generator will make it more accessible to more people. I think it makes sense to keep Hugo lean and doing what it does, and building tools up and around it. A generator fits the tool category really well.
To make sure this isnβt a technical bug, could you tree out your new theme directory. Is it the case that your head partial is empty, or does it not exist?
Create a new Hugo site with hugo new site incomplete Congratulations! Your new Hugo site is created in /tmp/incomplete.
Change to the folder of the new site with cd incomplete
Create a new theme with hugo new theme example Creating theme at /tmp/incomplete/themes/example
Set the theme of the site to example in /tmp/incomplete/config.toml with echo "theme = \"example\"" >> config.toml
Create some content with echo "Hello World" >> content/_index.md
It wont work yet, because we need to define βmainβ in themes/example/layouts/index.html. {{ define "main" }} {{ end }}
It still wonβt work, because the partial head.html is missing. Youβll receive an error when you run hugo serve.
Building sites β¦ ERROR 2018/06/24 01:04:23 Error while rendering "home" in "": template: index.html:2:8: executing "index.html" at <partial "head.html" ...>: error calling partial: Partial "head.html" not found
Total in 2 ms
Error: Error building site: logged 1 error(s)
Honestly I feel a bit offended by you @maiki. It took me quite much time to write this step by step description of my observation and you just send me a tutorial how I should Request for Help. Of course I can share the code with you, but I didnβt add anything extra than what Hugo generated except the _index.md as I described.
Donβt worry about the error I understand it. What Iβm trying here is to improve Hugo, because I think the generator could do more to be intuitive. So new users would run into less walls.
If you have a PR idea, then maybe make an issue in the github, and debate it there first.
At first, perhaps hugo new theme was designed in an βun-opinionatedβ way since there are a few ways you can design themes, or, it is simply that its defaults were decided before blocks were introduced. This project is after all staffed by volunteers so, itβs just a matter of time and desire to do something, and priority settingβ¦
I authored Requesting Help, because we get tons of vague requests for help without much info at all. It helps us a bit by saving time repeating the same thing.
But it appears that youβre talking more about changing the way hugo itself works, rather than asking for help with hugo usage.
Personally, I agree with making the hugo new theme use blocks and have some typical components from the start.
I like to get things done and move quickly, but I also agree that precise and careful engineering is more valuable than hasty reactions.
In this case I feel quite sure about what to do and I donβt see a point in discussing it again in an issue, so I just created an PR here: https://github.com/gohugoio/hugo/pull/4877