The [current-page:url] token should include the query string

Created on 23 June 2011, over 13 years ago
Updated 8 July 2024, 5 months ago

If I go to http://www.example.com/node?foo=bar, the [current-page:url] token should probably return the same.

πŸ“Œ Task
Status

Needs work

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States dave reid Nebraska USA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡¨πŸ‡ΏCzech Republic parisek

    Thank you, working for me, but CI test still not happy. Maybe best we can is separate problematic token to another issue?

  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 10.1.x + Environment: PHP 8.1 & MySQL 8
    last update over 1 year ago
    Patch Failed to Apply
  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 8.1 & sqlite-3.27
    last update over 1 year ago
    Patch Failed to Apply
  • πŸ‡·πŸ‡ΊRussia sashken2

    I'm use patch #21 from https://www.drupal.org/project/token/issues/1614456 β†’
    And it works good for me.

  • πŸ‡ΊπŸ‡ΈUnited States generalredneck

    Given that this issue is 5 years older than my oldest child and it can watch PG-13 without supervision, I created a module that handles the scenario and a few like it.

    I present Token Url Plus β†’ .

    This module (as the time of this writing) provides the tokens:

    [current-page:url-with-query]

    The URL of the current page with query string included, if it exists. This is the functionality we were looking for here.

    [current-page:url-with-query:without-some-parameters:param1,param2,…]

    The URL of the current page with query string included but filtered by removing the provided query parameters. e.g. 'without-some-parameters:utm_campaign,utm_medium,utm_source' would be replaced with the current url, with the three utm parameters filtered out if they existed.

    This is advanced usage for what you are looking for here

    [current-page:url-with-query:with-some-parameters:param1,param2,…]

    The URL of the current page with query string included but filtered to only include the provided query parameters. e.g. 'with-some-parameters:page,category_id' would return a url containing only query parameters, '?page=1&category_id=2' if they existed.

    You can use this one with metatags on views to support JUST the query parameters that the view provides.

    This will allow Token the module to remain unchanged and take the burden off of the decision for backward compatibility as expressed in #11.

  • πŸ‡¬πŸ‡§United Kingdom karengrey

    Thank you generalredneck, this is exactly what I needed!

  • πŸ‡ΊπŸ‡ΈUnited States SocialNicheGuru
Production build 0.71.5 2024