The default call for extractDomain doesn't work so well with domain names that use second-level domains, or countries that use second-level domains (e.g. New Zealand, Australia, etc.).
A restaurant such as Subway, using the New Zealand website https://www.subway.co.nz, appears as co.nz for the Website in the popup.
According to the extract-domain documentation, you can enable TLD support with extractDomain(this.tags.website, { tld: true }). It does have a slight performance impact, but for one call this would be less than 0.5 ms.
Alternatively, using regex to strip just the hostname from the URL would also work.
https://github.com/Rudloff/openvegemap/blob/0abd68fcc4ac5671512f5e40c012a3358eb751f6/js/popup.js#L123
The default call for
extractDomain
doesn't work so well with domain names that use second-level domains, or countries that use second-level domains (e.g. New Zealand, Australia, etc.). A restaurant such as Subway, using the New Zealand website https://www.subway.co.nz, appears asco.nz
for the Website in the popup.According to the extract-domain documentation, you can enable TLD support with
extractDomain(this.tags.website, { tld: true })
. It does have a slight performance impact, but for one call this would be less than 0.5 ms.Alternatively, using regex to strip just the hostname from the URL would also work.