I figured out a simple solution based on the standard Umbraco library. Take the absolute URL of a page https://www.example.com/some/page and trim out the relative part /some/page so only the hostname https://www.example.com is left. It should work no matter which page node you feed into it:
How to get hostname part of a page URL?
Let's imagine a page with
/some/page
as path and an absolute URL ofhttps://www.example.com/some/page
.How do I isolate and get the hostname part including scheme
https://www.example.com
dynamically?I figured out a simple solution based on the standard Umbraco library. Take the absolute URL of a page
https://www.example.com/some/page
and trim out the relative part/some/page
so only the hostnamehttps://www.example.com
is left. It should work no matter which page node you feed into it:Also, I found a few other solutions courtesy of Paul Seal that might be relevant to others.
is working on a reply...