When using {% css '/path/to/file.css' %} craft adds a v= query parameter by itself so that it comes out like this:

<link href="/path/to/file.css?v=1612895916" rel="stylesheet">

I can't find anything in the craft docs about changing this or making it something custom. The docs for css only states that

To register a CSS file, the URL must end in .css.

For various reasons I need to attach a couple of other url parameters to the generated link tag.

I know I could write the link tag myself and use twig in the href but I would like to take advantage of craft de-duplicating if the same css/js file is included multiple times. Likewise going the {{tag('link', {href:....)}} route would also not de-dupe if the tag was added multiple times.

Any idea on how to use a custom set of URL parameters?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.