Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When moving from one page to another [current-page:page-number] is not updated unless the cache is manually flushed.
Comment | File | Size | Author |
---|---|---|---|
#6 | pager-suffix.jpg | 29.62 KB | couturier |
#5 | add_pagination_to_cid_variable-1337750.patch | 545 bytes | marcelovani |
#4 | add_pagination_to_cid_variable-1337750-4.patch | 542 bytes | jarrodirwin |
#3 | add_pagination_to_cid_variable-1337750-3.patch | 484 bytes | jarrodirwin |
Comments
Comment #1
marikomay CreditAttribution: marikomay commentedSame problem using 7.x-1.0-alpha5+1-dev. [current-page:page-number] token does not update unless the cache is manually flushed. I am using Views 3 to override taxonomy term pages.
Comment #2
marikomay CreditAttribution: marikomay commentedIn case this is relevant, I am using the Omega theme.
Comment #3
jarrodirwin CreditAttribution: jarrodirwin commentedI am having the same issue. I have a taxonomy term index page which is built via an attached view. I am setting the pagination number in the page title manually using hook_metatag_metatags_view_alter. This works the first time after clearing cache however then it's cached.
The problem is that the caching CID does not take into consideration the page number you are on.
Attached is a simple patch to add the page number which fixes this.
Comment #4
jarrodirwin CreditAttribution: jarrodirwin commentedLast patch was giving notices when not on a paginated page. Added a check for the $_GET['page'] variable.
Comment #5
marcelovaniAdding a patch for the current DEV version
Comment #6
couturier CreditAttribution: couturier commentedMarcelovani's patch shows the correct page number for each page of a View. Please excuse my inexperience, but in order to get page numbers, all I knew how to do was to configure the Meta Tags Global Title to look like this:
[current-page:title] | [site:name] | [current-page:page-number]
Comment #4 is still relevant, that titles are "giving notices when not on a paginated page." But, this is okay with me. To explain, if I have any View, whether it is only one page or paginated, the title of the first page will always look like this:
<title>Name of the View Page | Name of my site | 1</title>
Pages that are not created through Views do not show any page number at all with marcelovani's patch. [Update: I just noticed that taxonomy term pages do show numbers.]
I have closed as a duplicate this issue that is related and turned this issue into a feature request since many people are interested in how to do this in Meta Tags. Here is the reason, from the previous issue:
Now, all we need is a way for newbies like me to know how to add the page number to Views page titles. Can we insert some documentation text into the Meta Tags UI? For example:
Or, it would be extra nice if we could configure this with it's own UI setting, just like Page Title does. Attached is a screenshot of this feature in Page Titles. This one feature is really the last major feature that people are saying Page Title does that Meta Tags does not (titles for comment nodes might be related, also). It would be great if everyone could make the final switch to Meta Tags so the maintenance energy can go into this one module for the future.
Comment #7
couturier CreditAttribution: couturier commentedI just updated my previous comment to note that taxonomy term pages are also showing a 1 when
[current-page:page-number]
is added to the Global title. However, there is a related issue underway to fix the problem that taxonomy term pages cannot be customized apart from inheriting the Global settings, at Support taxonomy term pages until taxonomy supports hook_entity_view().Comment #8
couturier CreditAttribution: couturier commentedI'm moving this back to bug report because two other bugs have just been fixed that also relate to taxonomy term pages (see this issue), and I know people want this caching fix committed even if the additional UI documentation I requested is not yet implemented.
Really, all it would take to help a lot of users right away is to add a line of documentation in the UI (probably under Global), as mentioned in #6, to say something like
For SEO purposes, to avoid duplicate titles for View and taxonomy term pages with pagination, override the Title and add [current-page:page-number] to the settings.
Comment #9
hass CreditAttribution: hass commentedI do not like to add the page number to every page. I'd like to have it only added if required.
Comment #10
DamienMcKennaCommitted! Thanks jarrodirwin, marcelovani and everyone for testing!
Comment #11
DamienMcKennaLets continue discussion in #1811386: Field to control suffix for use on page title fields.
Comment #12
DamienMcKennaRemoved the tag.
Comment #13
DamienMcKennaFYI a new hook was added to let the cache bits be altered before processing, which might help some developers work with custom pagers, etc: #1568164: Configuration of available tags to use / preventing caching
Comment #14
DamienMcKennaLast night saw the release of 7.x-1.0-beta1, so I'm closing all these "fixed" issues in the interest of tidying up the issue queue. Thank you all for your help getting us to this point!
Comment #15
couturier CreditAttribution: couturier commentedI just tried the new 7.x-1.0-beta1 release, and I still cannot get the [current-page:page-number] token to show up on paginated Views. The token will return a number "1" on regular nodes, though. It's strange, because it was working on paginated Views earlier.
I just tried downgrading back to the version I thought it was working on (Meta Tags version = "7.x-1.0-alpha8+10-dev" with marcelovani's patch from #5) and I couldn't get the token to show back up. I'm thinking it must be some interference with another module, maybe Tokens, that has affected this since my post in #6 where [current-page:page-number] was working on paginated Views.
We are waiting on a new token, [metatag:pager] to replace it, so that should probably solve this (and we should probably take out [current-page:page-number] from the list of available tokens if it continues to not work). Follow that feature request here: Add a customizable pager token to extend the normal Token pager.