fixed the include partial and its configuration. The primary issues were the lack of frontmatter stripping and restricted file system access for files outside the Hugo project

root.

  Changes Made:

   1. Improved include.html Partial:
       * Page Support: Now uses .Site.GetPage first, allowing files to be included via Hugo's virtual filesystem (mounts).
       * Frontmatter Stripping: Added a regex-based stripper to ensure that if a raw file is read via readFile, its YAML/TOML frontmatter isn't rendered as text/horizontal rules.
       * Shortcode Processing: Confirmed that RenderString correctly processes shortcodes within included content.

   2. Updated Hugo Configuration:
       * Added [[module.mounts]] to /srv/dev/hugo/wiki/config/_default/hugo.toml to expose your private documentation directory (/srv/docs/private) to Hugo as content/private.
This commit is contained in:
2026-03-28 04:22:29 +00:00
parent 319153c8c2
commit 09b40580b0
2 changed files with 26 additions and 8 deletions

View File

@@ -41,4 +41,11 @@ enableGitInfo = true
[markup.tableOfContents]
endLevel = 3
ordered = false
startLevel = 2
startLevel = 2
[module]
[[module.mounts]]
source = "content"
target = "content"
[[module.mounts]]
source = "/srv/docs/private"
target = "content/private"