替换元模块

如何替换元模块。
赞助

成为我们的资助者或赞助商,以支持我们的工作。

本页内容

赞助商

背景

起初,为了方便新手快速入门和熟悉 HB 框架的主题,我们提供了一些元模块,其只是模块的集合,本身并不提供任何功能。

但目前元模块有着一个明显的缺点,就是很难从中移除不需要的模块。因此在本教程中,我们将谈及如何从元模块中移除模块。

解决方案

为此,我们需要知道元模块导入了哪些模块,然后将其导入的模块__依次__地重新导入,并将不需要的模块去除,最后将元模块移除即可。

假设网站导入了 github.com/hbstack/meta/recommended 元模块。

1[[module.imports]]
2path = "github.com/hbstack/meta/recommended"
toml

首先,将元模块依次替换为其导入的模块。

Copy
[[module.imports]]
path = "github.com/hbstack/back-to-top"
[[module.imports]]
path = "github.com/hbstack/bigger-picture"
[[module.imports]]
path = "github.com/hbstack/code-block-panel"
[[module.imports]]
path = "github.com/hbstack/docs"
[[module.imports]]
path = "github.com/hbstack/docs/modules/breadcrumb"
[[module.imports]]
path = "github.com/hbstack/docs/modules/featured-image"
[[module.imports]]
path = "github.com/hbstack/docs/modules/heading-sign"
[[module.imports]]
path = "github.com/hbstack/docs/modules/doc-nav"
[[module.imports]]
path = "github.com/hbstack/blog"
[[module.imports]]
path = "github.com/hbstack/blog/modules/breadcrumb"
[[module.imports]]
path = "github.com/hbstack/blog/modules/featured-image"
[[module.imports]]
path = "github.com/hbstack/blog/modules/heading-sign"
[[module.imports]]
path = "github.com/hbstack/blog/modules/post-nav"
[[module.imports]]
path = "github.com/hbstack/blog/modules/related-posts"
[[module.imports]]
path = "github.com/hbstack/mermaid"
[[module.imports]]
path = "github.com/hugomods/katex"
[[module.imports]]
path = "github.com/hbstack/bootstrap"
[[module.imports]]
path = "github.com/hugomods/images"
[[module.imports]]
path = "github.com/hugomods/shortcodes"
[[module.imports]]
path = "github.com/hbstack/footer"
[[module.imports]]
path = "github.com/hbstack/footer/modules/socials"
[[module.imports]]
path = "github.com/hbstack/header"
[[module.imports]]
path = "github.com/hbstack/header/modules/language-picker"
[[module.imports]]
path = "github.com/hbstack/header/modules/socials"
[[module.imports]]
path = "github.com/hbstack/header/modules/search"
[[module.imports]]
path = "github.com/hbstack/header/modules/theme-toggle"
[[module.imports]]
path = "github.com/hugomods/seo/modules/alternatives"
[[module.imports]]
path = "github.com/hugomods/seo/modules/base"
[[module.imports]]
path = "github.com/hugomods/seo/modules/favicons"
[[module.imports]]
path = "github.com/hugomods/seo/modules/open-graph"
[[module.imports]]
path = "github.com/hugomods/seo/modules/schema"
[[module.imports]]
path = "github.com/hugomods/seo/modules/translations"
[[module.imports]]
path = "github.com/hugomods/seo/modules/twitter-cards"
[[module.imports]]
path = "github.com/hbstack/syntax-highlighting/styles/gruvbox"
[[module.imports]]
path = "github.com/hbstack/noscript"
[[module.imports]]
path = "github.com/hbstack/progress-bar"
[[module.imports]]
path = "github.com/hbstack/pwa"
[[module.imports]]
path = "github.com/hbstack/scrollbar"
view raw recommended/hugo.toml delivered with ❤ by emgithub

然后移除或替换不需要的模块,例如,你可能想将开源项目文档网站的 github.com/hbstack/header/modules/search 替换为 github.com/hbstack/header/modules/docsearch

razonyang
2025年4月3日星期四 2023年10月10日星期二