Modules
Customize and extend Hinode with Hugo modules.
Hinode supports Hugo modules to provide a flexible and extensible modular framework. By default, Hinode includes core building blocks for Bootstrap , FlexSearch , and Font Awesome . The following paragraphs explain how to customize the module configuration.
By default, the Hinode template imports Hinode as module itself. In this approach, the modules that Hinode includes are imported as transitive modules. Adjust the module
section in your site’s configuration file config/_default/hugo.toml
to import or adjust the required modules. Visit the Hugo documentation to
review all available configuration settings
. You can
disable individual modules
by setting disable
to true
.
[[module.imports]]
path = "github.com/gethinode/hinode"
The main repository of Hinode imports the following modules by default.
[[module.imports]]
path = "github.com/gethinode/mod-bootstrap"
[[module.imports]]
path = "github.com/gethinode/mod-csp"
[[module.imports]]
path = "github.com/gethinode/mod-flexsearch/v2"
[[module.imports]]
path = "github.com/gethinode/mod-fontawesome"
[[module.imports]]
path = "github.com/gethinode/mod-google-analytics"
[[module.imports]]
path = "github.com/gethinode/mod-katex"
[[module.imports]]
path = "github.com/gethinode/mod-leaflet"
[[module.imports]]
path = "github.com/gethinode/mod-lottie"
[[module.imports]]
path = "github.com/gethinode/mod-simple-datatables"
[[module.imports]]
path = "github.com/gethinode/mod-utils/v2"
Note
Hinode uses the default configuration defined in each referenced module since release v0.24.0 . You can override these settings in your site parameters.
You can choose to either fully integrate compatible modules or to include them on a page-by-page basis. For example, you might only want to display an interactive map on a few pages. In this case, you could choose to include the leaflet
module on an opt-in basis. This ensures the page size is minimized. On the other hand, as bootstrap
is used on every single page, it makes sense to include it as a core module.
For core modules, Hinode bundles the provided stylesheet files and JavaScript files into the main stylesheet and core script bundles. For optional modules, Hinode prepares separate stylesheet files and JavaScript files for each individual module. The configuration order of the core modules is important: the first module is processed before the next modules.
Note
Hugo uses two different algorithms to merge the filesystems, depending on the file type:
- For
i18n
anddata
files, Hugo merges deeply using the translation ID and data key inside the files.- For
static
,layouts
(templates), andarchetypes
files, these are merged on file level, so the left-most file will be chosen.
Adjust the modules
section in your site’s parameter configuration file config/_default/params.toml
to configure the various modules. Modules can include files for each of the following folders: archetypes
, assets
, content
, data
, i18n
, layouts
, static
. Modules can also have their own configuration files. Each module needs to be imported as well (
see the previous paragraph).
The following table provides an overview of the available settings for each module. Omit the mod-
prefix of the module’s name.
Setting | Default | Description |
---|---|---|
integration | optional | Module integration, either core or optional . Core modules are fully integrated with the Hinode site, including stylesheets and Javascript bundles. The modules are processed in order of priority, with the first module taking precedence. Optional modules are only included on those pages that reference the module in the frontmatter. Hinode includes the following core modules by default: [“bootstrap”, “flexsearch”, “fontawesome”]. |
excludeSCSS | false | Excludes the module from the stylesheet processing pipeline. Use this setting to get more control of when and where to include the module’s stylesheet. For example, the Bootstrap stylesheet is imported by the main stylesheet after initializing the theme variables, but before the custom component styles. |
disableTemplate | false | Excludes all scripts files from processing as Hugo template. The scripts are bundled as-is instead. This only applies to optional modules. |
localize | false |
v0.25.0
Triggers the creation of a language-specific bundle file. The language code is appended as suffix to the base name. For example, the English version of js/main.bundle.js becomes js/main.bundle.en.js . |
category | other |
v0.27.0
Assigns the module’s scripts to a category used for cookie consent. Available values are necessary , functional , analytics , performance , advertisement , and other . See
Cookie consent for more details. |
local | false | v0.27.0 Includes an external URL in local mode too. By default, external scripts are only included in the built site. |
url |
0.27.0
Optional url for an external link. If set, the link is included in the page header or page body, pending integration type. See the
scripts documentation for more information. |
For example, Bootstrap uses the following configuration in its module configuration:
[params.modules.bootstrap]
integration = "core"
excludeSCSS = true
Several modules support additional, module-specific configurations. Review them in the next paragraphs.
The cookieyes
module requires the following settings:
Setting | Default | Description |
---|---|---|
cookieyes.local | false | Trigger to force include the CookieYes scripts, bypassing other settings. Use this setting for debugging and testing only. |
cookieyes.url | Link to your personalized CookieYes script. See the installation code in the advanced settings of your CookieYes account. The code is available by clicking the button next to the cookie banner status. The link has the following pattern: https://cdn-cookieyes.com/client_data/{installation code}/script.js . |
The fontawesome
module supports the following additional settings:
Setting | Default | Description |
---|---|---|
fontawesome.embed | true |
v0.26.3
If set, generates a symbol map with embedded vector images. Only works in conjunction with inline . Include the symbol map with the partial assets/symbols.html (requires the current page context). |
fontawesome.inline | true | If set, uses inline vector images instead of web fonts. Both methods support Font Awesome styling and animation. However, when using vector images you cannot use aliases. Instead, use the default name of the icon. |
fontawesome.debug | true | If set, prints the original code <i class="[...]" style=[...]></i> as comments next to the inline vector image. |
fontawesome.skipMissing | false | If set, displays a warning when an icon cannot be found. The missing icon is replaced with a dummy. By default, Hinode exits with an error when an icon is missing. |
Note
By convention, Hinode uses kebab case as naming convention for module names. However, the module name in the site parameters is renamed to
GoogleAnalytics
to align with Hugo’s privacy settings.
Set you G-tag
in your site configuration (usually hugo.toml
) in the following section:
[services]
[services.googleAnalytics]
ID = "G-xxxxxxxxxx"
You can modify the privacy configuration in the following section:
[privacy]
[privacy.googleAnalytics]
disable = false
respectDoNotTrack = false
The google-analytics
module supports the following additional settings:
Setting | Default | Description |
---|---|---|
GoogleAnalytics.local | false | Trigger to force include the analytics scripts, bypassing other settings. Use this setting for debugging and testing only. |
The utils
module supports the following additional settings:
Setting | Default | Description |
---|---|---|
utils.filter | [^0-9A-Za-zŽžÀ-ÿ ;.,\/'’"] |
Defines the regular expression for characters to remove from page descriptions. These page descriptions are used to define card content and metadata for search indexes. Adjust the filter to define which characters to support. You may need to adjust these settings to support specific diacritical letters. |
utils.raw | false | Flag to indicate page descriptions should be returned as-is. In this setting, the filter is ignored. |
You can enable an optional module for a specific page by setting the following value in the page’s frontmatter:
---
modules: ["leaflet"]
---