diff --git a/content/en/guides/modules/index.md b/content/en/guides/modules/index.md index b952f16b..30a78234 100644 --- a/content/en/guides/modules/index.md +++ b/content/en/guides/modules/index.md @@ -162,13 +162,13 @@ As a final step we will include a basic script to initialize KaTeX when the page The module template provides a simple website for local testing. Open the file `exampleSite/hugo.toml` and update the configuration: ```toml -[module] - replacements = 'github.com/markdumay/mod-katex -> ../..' + # Build and serve using local mod-katex clone declared in the named Hugo workspace: + workspace = "mod-katex.work" [[module.mounts]] source = "static" target = "static" [[module.imports]] - path = "github.com/markdumay/mod-katex" + path = "github.com/gethinode/mod-katex" [[module.imports.mounts]] source = "dist/katex.scss" target = "static/katex.css" @@ -184,9 +184,14 @@ The module template provides a simple website for local testing. Open the file ` [[module.imports.mounts]] source = "assets/js/modules/katex/katex-autoload.js" target = "static/js/katex-autoload.js" + [[module.imports.mounts]] + source = 'layouts' + target = 'layouts' ``` -The `replacements` instruction tells Hugo to source the `mod-katex` module from the parent folder instead of the remote repository. This is of great help for local development and testing, as we would otherwise need to synchronize our repositories, submit a PR, and pull the latest version for each revision. The next line instructs our example site to use the `mod-katex` module (now sourced locally) and to adjust the mount points of the `.css` file and `.js` files. In this simple site for testing, we have no need for complex processing or bundling of assets, so we can use static imports instead. +The configuration uses a [workspace](https://gohugo.io/hugo-modules/use-modules/#module-workspaces) to simplify local development. Rename the existing template file from `mod-template.work` to `mod-katex.work` for consistency. Ensure you reference the correct file in the above configuration. + +Workspaces are of great help for local development and testing, as we would otherwise need to synchronize our repositories, submit a PR, and pull the latest version for each revision. The next line instructs our example site to use the `mod-katex` module (now sourced locally) and to adjust the mount points of the `.css` file and `.js` files. In this simple site for testing, we have no need for complex processing or bundling of assets, so we can use static imports instead. We will now run the `mod:update` script to install the Hugo module(s) and to check for any updates. The `package.json` contains several scripts to help us: