"Static analysis" for hugo sites with "strict mode" (build time safety against unintentional errors)

I also made an issue for this: "strict mode" that make build fail on missing links, unused keys etc. · Issue #14108 · gohugoio/hugo · GitHub

But basically I want to have more build time safety for unintentional errors, just like a statically typed language gives safety during refactoring.

I’m able to get internal link checking to work, but I had to manually check stuff as GPT-5 was not smart enough to do it in 2-3 shots, this just tells me it is not well documented enough

Internal link checks worked by just adding the below in layouts/_markup/render-links.html (ref. Link and image render hooks - Veriphor ):

{{- $u := urls.Parse .Destination -}}
{{- $isAbs := or (ne $u.Scheme "") (strings.HasPrefix .Destination "//") -}}

{{- if not $isAbs -}}
  {{- $page := site.GetPage $u.Path | default (.Page.GetPage $u.Path) -}}
  {{- $res  := cond (not $page) (resources.Get $u.Path) nil -}}

  {{- if not (or $page $res) -}}
    {{- errorf "Broken internal link %q on %s" .Destination .Page.File.Path -}}
  {{- end -}}

  {{- if and $page $u.Fragment -}}
    {{- if not ($page.Fragments.Identifiers.Contains $u.Fragment) -}}
      {{- errorf "Broken fragment #%s in link %q on %s" $u.Fragment .Destination .Page.File.Path -}}
    {{- end -}}
  {{- end -}}
{{- end -}}

<a href="{{ .Destination | safeURL }}"{{- with .Title }} title="{{ . }}"{{- end }}>{{ .Text | safeHTML }}</a>