New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

html-add-querystring

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

html-add-querystring

Add querystring parameters to all links in html code

  • 1.5.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-90%
Maintainers
1
Weekly downloads
 
Created
Source

NPM

html-add-querystring

Add querystring parameters to all links in html code

Install

npm i html-add-querystring

Use

const haq = require('html-add-querystring');

const html = '<html><body><a href="http://example.com">Test</a></body></html>';
const params = {foo: 'bar'};
const result = haq(html, params);
// result is '<html><head></head><body><a href="http://example.com/?foo=bar">Test</a></body></html>'

Note that the resulting html is somewhat cleaned up (head added in example aboce) because of the underlying use of cheerio.

A good use case for this package is to add UTM Parameters to links in emails. If you process includes rendering emails from templates (potentially pug or others), inlining css with Juice, then this is for you. Simply feed the resulting html through this package with the appropriate utm parameters and all links in the email will have UTM Parameters.

If you're using "invalid urls", e.g. placeholder variables, you can pass an options object {strict: false} to haq as third parameter to simply return invalid urls instead of throwing an error.

Changelog

[1.4.1] - 2021-06-08

  • dependency update

[1.4.0] - 2021-05-07

  • dependency updates

[1.3.0] - 2019-08-26

  • (dev) dependency updates

[1.2.0] - 2019-05-14

  • dependency updates

[1.1.0] - 2018-08-22

Added
  • strict: false option
Changed
  • updated dev dependencies

License

MIT

Keywords

FAQs

Package last updated on 11 Jul 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc