I’d like to show the domain name in rendered hyperlinks, e.g. [link text](subdomain.domain.com/page) to render as “link text (domain.com)”. This way the readers can see where the link is going (without hovering). I’m quite close but hope somebody can help:
How to get the domain only from the url, without subdomains (e.g. gohugo.io instead of discourse.gohugo.io)? I need to concatenate the last two elements from $splitDomain
How to make this work for internal links when destination is set to a page only. Can I render the full url?
Thanks, this simplifies my snippet, and I found absUrl to normalise my relative & absolute links (this prevents forking the logic when using IsAbs). I now have the following:
However, Hostname still includes subdomains, and not only the domain. Any idea how to fix this? How can I take & concatenate the last 2 elements of $domain?