Closed elsatch closed 2 years ago
Did you commit your go.mod
and go.sum
files?
I have taken an extended look to other resources and now it works. So, yes, you can use this module if you use actions-gh-pages to build your site.
These are the steps I took to solve my issue:
hugo mod init mysite.github.io
at the root level of my repo to initialize it a Hugo modulehugo mod get
to make Hugo read the config file and download hugo-mod-mermaidjsOnce the module was loaded on my local Hugo repository, the action-gh-pages executed without any errors. Execution time increased around 20 secs compared to previous executions.
Run hugo --minify
hugo: downloading modules …
hugo: collected modules in 25210 ms
If you believe this could be useful to other people, I could update README.md with the instructions and send you a pull request. What do you think about it?
The official documentation Use Hugo Modules | Hugo describes that. We are happy to have the link on our README. Could you make your pull-request? :)
Also, I like updating the official documentation.
I just added the link and a brief description on README and made the pull-request.
Regarding the official documentation, I agree that missing information and examples should be updated there.
As a newcomer to the Hugo ecosystem, there are several parts that are super easy to start working on, but others depend on a deeper knowledge of Go. Some concepts might be evident to more seasoned programmers but invisible to us.
For example, in the Use Hugo Modules guide they explain that you must initialize a module before using it. They use the example of the gohugoio/myShortcodes. I assume this module contains some shortcodes in html files, that can be included in your theme/shortcodes folder.
Then it jumps to the using a module for a theme section. Given I want to import hugo-mod-mermaidjs to my site, and not just to my theme, I assumed this section did not apply to me. Why would I need to init my repo as a Hugo module? It is never explained in the official documentation.
Maybe at this step I was a bit biased after reading Master Hugo Modules: Managing Themes As Modules. I thought people were configuring their themes as Hugo modules but reading the official docs it says: "Use a Module for a Theme" not "Use a Module as a Theme". It is a bit confusing!
Other random thoughts on documentation:
hugo mod init hugo-mod-mermaidjs
to start working with the modulehugo mod get
to get it locally installed. This command is included under the "Update Modules" header, instead of "Get modules" or "Install modules"Hugo modules overview information is sparse and points to Go references mostly. The opening line is not super clear either: "A module can be your main project or a smaller module". Great but... where do I go from there?
I will check official Hugo repo and see if someone is working on this topic, as I feel it's too step for newcomers. (Bingo! Eight days ago someone posted this issue
Thanks for you time and feedback!
Closed by #2
I have just discovered this repository and tried to add it to my Hugo site. It is hosted here on GitHub and I am using action-gh-pages to construct it.
I am using the geeky-hugo theme that uses toml files for configuration, so I tried to adapt the yaml format in the documentation. My modules section on config/_default/config.toml looks like this:
As I push this change into the repository, I am getting an error in the action log:
So I am wondering if is it possible to import these modules on the Github actions, or if module import is restricted in some way into this environment.
I have taken a look to the project docs, the Hugo documentation about modules, but there are not lots of examples on how to use these modules in Hugo.