is_letsencrypt_valid_hostname
See also
Test if a hostname can be used for a Let’s Encrypt certificate.
Criteria are:
Does resolve using DNS
The resolved address is not a LAN address
The address is reachable
And the current site is listening for the hostname on that address
The site must listen on port 80 for connections.
For example, check if the current site is reachable as example.com:
{% if "example.com"|is_letsencrypt_valid_hostname %}
Wow, this site is example.com!?!
{% endif %}