Open maddovr opened 1 year ago
Hi, could you please post the error you get when you run the command in step 2 in the README?
Error: failed to get ["-d" "-u" "github.com/canstand/compost"]: failed to execute 'go [get -d -u github.com/canstand/compost]': failed to execute binary "go" with args [get -d -u github.com/canstand/compost]: go: go.mod file not found in current directory or any parent directory.
This is what I get with latest hugo extended and copying the required snippet from your readme. I have to say I'm unfamiliar with hugo, my current blog is in jekyll but I would like to switch due to growing frustrations with jekyll, so I'm still a total noob at hugo.
Because the theme uses the Hugo Modules feature, you need to install golang.
See https://gohugo.io/installation/linux/#prerequisites
Go is required to:
- Use the Hugo Modules feature
- Build Hugo from source
I have golang installed already through scoop go version go1.20 windows/amd64
and the go binary is in PATH. I'm on windows and the error is still the same.
Maybe you need to run hugo mod init
first?
I have the same issue.
I got the same issue
I have the same issue.
I got that too
Two possible reasons to check:
git submodule
command, since this theme uses the Hugo Modules approach.go mod init
is used to initialize your own project, so maybe follow the instructions in the official documentation here, run hugo mod init github.com/<your_user>/<your_project>
.I got it to work.
This is the full step-by-step that should work for everyone from scratch:
scoop install go hugo-extended nodejs-lts
hugo new site mysite
cd ./mysite
hugo mod init mysite # this is the critical step I believe most of us missed!
Add-Content ./hugo.toml @'
theme = 'github.com/canstand/compost'
# required
[build]
_merge = 'deep'
# required
[markup]
_merge = 'deep'
# for better seo
[minify]
_merge = 'deep'
'@
hugo mod get -u
hugo mod npm pack
npm install
then when you run hugo serve
or hugo server
you will get a 3 errors like this:
execute of template failed: template: partials/analytics.html:1:15: executing "partials/analytics.html" at <.Site.IsServer>: can't evaluate field Site in type *page.siteWrapper
to fix this go to the partials/analytics.html
file (the full path should be in the error message) and delete all of its content (just clear it out).
Then I had to run npm install
one more time and then hugo serve
and the site came up successfully!
Just adding my own experience report. I did my best to follow the gist of this conversation and the README instructions using WSL2.
$ hugo new site hugotest
Congratulations! Your new Hugo site is created in /home/coder/workspace/hugotest/hugotest.
Just a few more steps and you're ready to go:
1. Download a theme into the same-named folder.
Choose a theme from https://themes.gohugo.io/ or
create your own with the "hugo new theme <THEMENAME>" command.
2. Perhaps you want to add some content. You can add single files
with "hugo new <SECTIONNAME>/<FILENAME>.<FORMAT>".
3. Start the built-in live server via "hugo server".
Visit https://gohugo.io/ for quickstart guide and full documentation.
$ cd hugotest
$ ls
archetypes/ assets/ content/ data/ hugo.toml layouts/ static/ themes/
$ hugo mod init hugotest
go: creating new go.mod: module hugotest
go: to add module requirements and sums:
go mod tidy
$ # here, I inserted the required text into `hugo.toml`
$ hugo mod get -u
go: no module dependencies to download
go: downloading github.com/canstand/compost v0.6.0
go: added github.com/canstand/compost v0.6.0
hugo: collected modules in 1575 ms
$ hugo mod npm pack
$ npm install
added 134 packages, and audited 135 packages in 9s
27 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
npm notice
npm notice New minor version of npm available! 9.5.0 -> 9.8.1
npm notice Changelog: https://github.com/npm/cli/releases/tag/v9.8.1
npm notice Run npm install -g npm@9.8.1 to update!
npm notice
$ hugo serve
Watching for changes in /home/coder/workspace/hugotest/{archetypes,assets,content,data,layouts,package.hugo.json,package.json,static}
Watching for config changes in /home/coder/workspace/hugotest/hugo.toml, /home/coder/workspace/hugotest/go.mod
Start building sites ā¦
hugo v0.117.0-b2f0696cad918fb61420a6aff173eb36662b406e linux/amd64 BuildDate=2023-08-07T12:49:48Z VendorInfo=gohugoio
| EN
-------------------+-----
Pages | 7
Paginator pages | 0
Non-page files | 0
Static files | 4
Processed images | 0
Aliases | 0
Sitemaps | 1
Cleaned | 0
Built in 584 ms
Environment: "development"
Serving pages from memory
Running in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender
Web Server is available at http://localhost:1313/ (bind address 127.0.0.1)
Press Ctrl+C to stop
hugo serve
ended up presenting me with this:
And there were no error messages in the console. I really liked the demo I saw of this theme, but I wish it were easier to use. I'm not especially interested in troubleshooting this issue at the moment, just letting you know what I experienced before I go back to the theme library and look for another.
The config required for version v0.6.0 has add this:
# required
[module]
_merge = 'deep'
See https://github.com/canstand/compost#usage
There was an issue with the daily build of themes.gohugo.io
not reflecting new releases and README from Compost.
Yes, I had used that portion from the README here on GitHub. Iām really unsure what went wrong.
It is true that there is a issue with the css built when running hugo server
for the first time in a new project.
After Ctrl+C, run hugo server
again and refresh the page and it will be normal.
It is not yet known why.
It's related to https://github.com/gohugoio/hugo/issues/11403, see the latest version of usage.
@canstand, Is it possible to disable displaying Hugo Variables for the current page?
I used the latest theme with hugo v0.121.2.
It's only show when hugo server
for develop, not in hugo build
.
It's only show when
hugo server
for develop, not inhugo build
.
Thanks for your quick reply! I got it!
Hugo newbie here āš¼
I liked this theme and needed clarification about installing it because the README assumes I am familiar with Hugo, so I checked out this issue. For anyone looking for answers, here's a step-by-step to complete the setup:
brew install go
)hugo mod init github.com/yourusername/yourproject
theme = 'github.com/canstand/compost'
to your hugo.toml
filetoml
config info described in the README to your hugo.toml
filenode_modules
and .hugo_build.lock
to .gitignore
Hugo newbie here āš¼
I liked this theme and needed clarification about installing it because the README assumes I am familiar with Hugo, so I checked out this issue. For anyone looking for answers, here's a step-by-step to complete the setup:
- Make sure to have Go installed (for me on Mac:
brew install go
)- Init mods in your project with your repo path: e.g.,
hugo mod init github.com/yourusername/yourproject
- Add
theme = 'github.com/canstand/compost'
to yourhugo.toml
file- Paste the
toml
config info described in the README to yourhugo.toml
file- Run the install commands described in the README
- Add
node_modules
and.hugo_build.lock
to.gitignore
This saved my day!
I had to remove hugo.toml to use config.toml, as it is reading hugo.toml first.
Hello and sorry to bother you with a noob question, but apparently recent versions of hugo do not really support the way you described in the readme to install the theme or maybe I'm doing something wrong. Could you please explain how to install and use your theme (possibly the tagged releases instead of the main branch) in detailed steps?