Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-16495

Metatag canonicals are broken, q is multiplied

    Details

    • Documentation Required?:
      None
    • Funding Source:
      Contributed Code

      Description

      Drupal integration for CiviCRM has hook implementation for hook_metatag_metatags_view_alter(). This implementation is done a bit wrong way, as it adds Drupals "q" query parameter as visible query part to urls. And this breaks canonicals for normal Drupal pages when clean urls are enabled.

      Case:

      Drupal 7 with token and metatag modules enabled and with CiviCRM (4.6.2), running on nginx + php-fpm, clean urls enabled. For nodes, canonicals are defined, with metatag module, to: [current-page:url:unaliased:absolute]

      Before hook_metatag_metatags_view_alter() implementations are called, canonical has right content. For example if URL to page is "http://www.domain.tld/node/1234" canonical is "http://www.domain.tld/node/1234". But after CiviCRMs implementation is executed canonical is changed to "http://www.domain.tld/node/1234?q=node/1234".

      This happens because commits that fix issue CRM-15871 are done a bit wrong way.

      Proposed resolution

      Query parameters should be get with function drupal_get_query_parameters() or otherwise also query parameter q should be removed.

      Instead of custom function, _civicrm_get_url_parameters(), I strongly suggest that only use of that function is replaced with drupal_get_query_parameters(). All query excludes can be handled with drupal_get_query_parameters().

        Attachments

          Activity

            People

            • Assignee:
              yashodha Yashodha Chaku
              Reporter:
              wilei Ville Heimonen
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: