Hwaro::Content::Processors::InternalLinkResolver
Constants
Matches any href/src attribute value (relative or absolute).
Matches href="@/path" and href="@/path#anchor"
Matches a plain root-relative href/src value (e.g. href="/posts/").
\/[^\/"] excludes protocol-relative //host URLs; the alternation
also allows a bare / (the homepage link).
A URI scheme prefix (e.g. https:, mailto:, tel:, data:).
Instance methods
Make every relative href/src in html absolute against page_url
(an absolute URL like "https://host/blog/post/").
Feed bodies (RSS content:encoded, Atom <content>) are consumed out
of the page's URL context, so document-relative ("../x/") and
root-relative ("/img.svg") links must be absolutized — otherwise a
reader resolves them against the feed/reader URL and they break.
Absolute URLs, protocol-relative (//host), scheme links
(mailto:/tel:/data:), and pure in-page anchors (#x) are left
untouched. A no-op when page_url is not an absolute URL (no host
to resolve against — e.g. an empty base_url deploy).
Prefix plain root-relative links in rendered content (e.g. a scaffold
or author-written [Posts](/posts/) -> <a href="/posts/">) with the
base_url path component so they resolve under a subpath deployment
(GitHub/GitLab project pages served at https://user.github.io/repo/).
This mirrors Config#with_base_path for content-body anchors that the
template layer never touches. Because page.content is reused by the
feed and search generators, fixing it here also keeps RSS
<content:encoded> and the search index subpath-correct.
A complete no-op when base_url has no subpath (the common
domain-root deploy), so root-relative links are preserved there.
Protocol-relative (//host), absolute (http(s)://), anchor (#),
and already-prefixed links are left untouched.
Resolve internal @/ links in HTML to actual page URLs.
html— rendered HTML stringpages_by_path— map from content path (e.g. "blog/post.md") to Pagesource_path— path of the page being rendered (for warning messages)base_url— site base_url, used to prepend the path component (e.g. "/noir") so links work when the site is served from a subpath. When empty or root, no prefix is added and behavior matches the previous output.misses— optional accumulator for unresolved links. Each entry is{target, reason}with reason "page not found" or "empty link". Callers running under[links] broken_internal = "error"collect them to fail the build after the render fan-out; warnings are still logged either way.nilkeeps warn-only behavior.