instantpage / instant.page

Make your site’s pages instant in 1 minute and improve your conversion rate by 1%
https://instant.page
MIT License
6.04k stars 205 forks source link

Please support classname #64

Open gralance opened 4 years ago

gralance commented 4 years ago

For Wordpress user, it's hard to set data-instant in the a tag without changing code. if the Wordpress plugin could let user set customized classnames, It makes easier for Wordpress user.

e.g.: <a href="somewhere" class="data-instant">Link</a> <a href="somewhere" class="my-custom-instant-class">Link</a>

In my use case, I just want to add the data-instant flag on links in WooCommerce's product link and the links on navigation bar, but exclude the MyAccount and the Cart pages since there are dynamic page.

gralance commented 4 years ago

Figured out a workaround. Install a plugin that let you put custom script code in the footer

Use the following code snippet

[].forEach.call(document.getElementsByClassName('your-class-name') , x => x.dataset.instant = 1)

You can change the 'your-class-name' to the classname you want, or put a selector syntax in it.