.hugo/layouts/shortcodes/list-tools.html
{{/* Set Database Title */}} {{ $dbTitle := .Page.Title }} {{/* Gather & Pre-filter Native Tools (from the local "tools" sub-folder) */}} {{ $validNativeTools := slice }} {{ $localTools := .Page.GetPage "tools" }} {{ if $localTools }} {{ range $localTools.RegularPages }} {{ if not .Params.is_wrapper }} {{ $validNativeTools = $validNativeTools | append . }} {{ end }} {{ end }} {{ end }} {{/* Track if we've printed the main H3 header yet */}} {{ $headerPrinted := false }} {{/* Display Native Tools ONLY if valid ones exist */}} {{ if gt (len $validNativeTools) 0 }}
{{ $headerPrinted = true }}
| Tool Name | Description |
|---|---|
| {{ range $validNativeTools }} | {{ .Title }} |
| {{ end }} | |
| {{ end }} {{/* Gather & Display Inherited Tools */}} {{ $dirsParam := .Get "dirs" }} {{ if $dirsParam }} {{ range split $dirsParam "," }} {{ $dirPath := trim . " " }} {{ $targetDir := site.GetPage $dirPath }} {{ if $targetDir }} {{/* Since $targetDir is the "tools" folder, the DB name is simply its parent */}} {{ $remoteDbTitle := $targetDir.Parent.Title }} {{/* Pre-filter Inherited Tools */}} {{ $validExternalTools := slice }} {{ range $targetDir.RegularPages }} {{ if not .Params.is_wrapper }} {{ $validExternalTools = $validExternalTools | append . }} {{ end }} {{ end }} {{ if gt (len $validExternalTools) 0 }} {{/* Print the main H3 if the native tools block didn't already print it */}} {{ if not $headerPrinted }} |
{{ $headerPrinted = true }} {{ end }}
_ {{ $dbTitle }} maintains full compatibility with {{ $remoteDbTitle }} , allowing you to use the following tools with this connection:_
| Tool Name | Description |
|---|---|
| {{ range $validExternalTools }} | {{ .Title }} |
| {{ end }} | |
| {{ end }} {{ else }} |
Warning: Tool directory '{{ $dirPath }}' not found.
{{ end }} {{ end }} {{ end }} {{/* Fallback if absolutely NO tools exist anywhere */}} {{ if and (not $headerPrinted) (not $dirsParam) }}
No tools found to display.
{{ end }}