0

I am trying to get a URL including all parameters as a string in a Twig template but I'm unable to achieve that in Twig.

Is there a way we can get the url include parameter as string in Drupal 8?

I did this with theme_preprocess_node() but I get PANTHEON_STRIPPED in some the parameter as I host my website on Pantheon.

My URL is:

https://example.com?abc=1&xyz=2&utm_content=1&utm_source=hs_email

But I get result like this:

https://example.com?abc=1&xyz=2&utm_content=PANTHEON_STRIPPED&utm_source=PANTHEON_STRIPPED

How I get the correct URL in the Twig template as a string?

0

Most CDNs are stripping query parameters typically used by client-side javascript and normally not needed server-side. You can't access the original values because the CDN caches only the stripped version and the original values you might find in the headers are random from the user who requested the page first.

0
&utm_content=PANTHEON_STRIPPED&utm_source=PANTHEON_STRIPPED

This tells me that your URL parameters are being filtered or stripped by the CDN/Host. While it's too much to get into here, generally these are bad for multiple reasons.

I would contact your CDN/host or reconfig your application to not use URL params. Using a path and then splitting the path array on the app side is the way to go.

Hope this helps.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.