diff --git a/src/transformers/urlParameters.js b/src/transformers/urlParameters.js
index 098d967d..b57bf847 100644
--- a/src/transformers/urlParameters.js
+++ b/src/transformers/urlParameters.js
@@ -6,11 +6,11 @@ module.exports = async (html, config = {}, direct = false) => {
const urlParameters = direct ? config : get(config, 'urlParameters', {})
if (!isEmpty(urlParameters)) {
- const {_options, ...parameters} = urlParameters
- const tags = _options.tags ?? ['a']
- const strict = _options.strict ?? true
- const qs = _options.qs ?? {encode: false}
const posthtmlOptions = get(config, 'build.posthtml.options', {})
+ const {_options, ...parameters} = urlParameters
+ const tags = get(_options, 'tags', ['a'])
+ const strict = get(_options, 'strict', true)
+ const qs = get(_options, 'qs', {encode: false})
return posthtml([urlParams({parameters, tags, qs, strict})]).process(html, posthtmlOptions).then(result => result.html)
}
diff --git a/test/test-transformers.js b/test/test-transformers.js
index 15194830..00e719a1 100644
--- a/test/test-transformers.js
+++ b/test/test-transformers.js
@@ -315,20 +315,35 @@ test('filters (postcss)', async t => {
})
test('url parameters', async t => {
- const html = await Maizzle.addURLParams(
+ const simple = await Maizzle.addURLParams(
+ `test
+ `,
+ {
+ bar: 'baz',
+ qix: 'qux'
+ }
+ )
+
+ const withOptions = await Maizzle.addURLParams(
`test
`,
{
_options: {
tags: ['a[href*="example"]'],
- strict: false
+ strict: false,
+ qs: {
+ encode: true
+ }
},
- bar: 'baz',
- qix: 'qux'
+ foo: '@Bar@',
+ bar: 'baz'
}
)
- t.is(html, `test
+ t.is(simple, `test
+ `)
+
+ t.is(withOptions, `test
`)
})