Get Domain Name from URL

Hello.
Is it possible to extract only the domain name from a URL?
https://www.example.com > example

Thanks

I tried something like this:

{{ $url := urls.Parse "https://www.example.com" }}	
{{ $name := slice $url.Host "." }}

ā€¦?

EDIT
Got it :slight_smile:

{{ $url := urls.Parse "https://www.example.com" }}	
{{ $name := split $url.Host "." }}
{{ index $name 1 }}
3 Likes