Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/erikgiovani/hidden-from-bots

Say goodbye to bots looking for emails and phone numbers.
https://github.com/erikgiovani/hidden-from-bots

email javascript javascript-library

Last synced: about 2 months ago
JSON representation

Say goodbye to bots looking for emails and phone numbers.

Awesome Lists containing this project

README

        


#

Hidden From Bots

Normally on the internet there are bots, crawlers or spiders, they are all the same with a different name and are dedicated to searching the internet for data such as emails, phone numbers and other data, although not all of them are bad like of google that is in charge to analyze your site to be able to index it in their search engine, there are others that are, although you can create a robots.txt file and add a configuration to avoid bots, some people can create bots to ignore if there is a robots file .txt and they can scan still your site and collect your email or phone number to be able to send spam, make phone scams or sell that data to companies so they can send you unwanted advertising.

Luckily with Hidden From Bots you can avoid most of these annoying bots by hiding these elements from the dom.



Installation



**NPM**

```console
npm i hidden-from-bots
```
**Yarn**

```console
yarn add hidden-from-bots
```
**CDN**

``` js
https://cdn.jsdelivr.net/npm/hidden-from-bots/+esm
```


Usage



To use **Hidden From Bots** without **Node JS** you need to create a js file and add it to the end of the body tag in your html document and set it to be of type module so it can work.

```html




Hidden From Bots

```



In your js file you need to import from the CDN **emailHiddenF** if you want to hide an email or **phoneHiddenF** if you want to hide a phone number, in this case I am going to hide an email.

```js
import { emailHidden } from 'https://cdn.jsdelivr.net/npm/hidden-from-bots/+esm';
```



And then you have to call the function and add the email in quotes inside it.

```js
import { emailHidden } from 'https://cdn.jsdelivr.net/npm/hidden-from-bots/+esm';

emailHidden('[email protected]')
```



To finish you need to add a **p** tag with the **data-hidden-from-bots** attribute with the value **email** if it is going to be an email you want to hide and **phone** if it is going to be a phone number.

```html




Hidden From Bots

Email

```



Excellent, if you like you can also have an email and phone number at the same time always remembering to use the correct attribute value for each one.


Advanced Usage



If you want to have several different emails you have to import the **multiEmailHiddenF** function and if you want to have several different phone numbers you have to import the **multiPhoneHiddenF** function.

```js
import { multiEmailHiddenF } from 'https://cdn.jsdelivr.net/npm/hidden-from-bots/+esm';

multiEmailHiddenF('email1','[email protected]');
multiEmailHiddenF('email2','[email protected]');
multiEmailHiddenF('email3','[email protected]');
```



And in the value of the **data-hidden-from-bots** attribute put the first parameter of the function.

```html




Hidden From Bots

Email


Email


Email

```

---

Made with ❤️ by **Erik Giovani**