To encrypt a mailto link in HubSpot CMS and prevent crawlers from reading the email address, you can use JavaScript to dynamically generate the link. Here’s a basic approach:
Create a Script: Insert a script in your HubSpot CMS template or page that generates the mailto link dynamically.
<script type="text/javascript">
// Replace 'your-email@example.com' with your actual email address
var encryptedEmail = "your-email@example.com".split('').map(function(char) {
return '&#' + char.charCodeAt(0) + ';';
}).join('');
document.write('<a href="mailto:' + encryptedEmail + '">Contact Us</a>');
</script>
This script converts each character of your email address into its HTML entity (e.g., @ for '@').
Displaying the Link: When the page loads, JavaScript will render the email address as a clickable mailto link. Crawlers scanning static HTML won't interpret the email address directly.
Testing and Deployment: Test the implementation to ensure the email link works correctly. Deploy it on your HubSpot pages where needed.
This method helps protect your email address from web crawlers while still allowing users to contact you via email. Make sure to replace 'your-email@example.com' with your actual email address in the script.