-1

I am using [current-page:page-number] token in title and metatag description. Pager in views, gives second page of view as "Page 1" and token gives first page of view as "Page 1".

This creates difference in URL`s and title tag, such as : Title: Daily News - Page 2 | example.com URL: http://example.com/news?page=1

How to decrease value of [current-page:page-number] token by 1?

1 Answer 1

-1

I was able to achieve this by modifying token.tokens.inc. At line 755, I added this code :

 if ((int)$page>0)
      { $page_num = $page;
      $replacements[$original] = " - Page ".$page_num;
      }
      else  
      $replacements[$original] = "";
      break;

Is there any cleaner way to do it by writing custom module or hook?

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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