metatag module is one of the modules on drupal.org who have the best support. please provide a option to allow users to add the rel=prev / rel=next options like in the book.module


#13 metatag-main_module_rel_prev_next-1868460-13.patch1.55 KBpreshetin
PASSED: [[SimpleTest]]: [MySQL] 101 pass(es). View
#15 interdiff-1868460-13-15.txt576 bytespreshetin
#15 1868460-15.patch1.53 KBpreshetin
PASSED: [[SimpleTest]]: [MySQL] 101 pass(es). View
Members fund testing for the Drupal project. Drupal Association Learn more


remkovdz’s picture

+1. Right now, I use the Clean Pagination module to achieve this, but I'd rather have this handled by Meta Tags too. Seems logical?

DamienMcKenna’s picture

Component: Code » Other tags
bamjam’s picture


Makes a lot of sense to me. I'd like to get involved in the development but after an hour poking round the module source I'm quite confident I'd need some guidance.

ForTheWin’s picture

@remkovdz, Thank you for posting the link to the Clean Pagination module!! This is exactly what I'm looking for.

ForTheWin’s picture

Ben Finklea’s picture

Great idea. Any word on this?

DamienMcKenna’s picture

Waiting for someone to put together a patch; I'll get to it eventually (#1572474: Add Revisions to Metatags for Entities comes first) if nobody beats me to it.

andrew_ar’s picture

Issue summary: View changes

@DamienMcKenna, any luck you can add this? It'd be a great edition to MetaTags.

broadway’s picture

Any hope of adding this?

In the Advanced section of Meta Tags, on a node level, I can declare anything I want for a Canonical tag.
Why would a similar type of input box for rel="prev" and rel="next" be a difficult feature to add to Meta Tags too?

DamienMcKenna’s picture

Issue tags: +Novice

@broadway: It isn't difficult and that's the plan, it's time to write it. Until now I've been focused on a busy primary job, several side contracts, keeping my family going (with a currently 17mo infant, two older children, wife, dog, two cats), trying to keep healthy & sane, and several bugs in several modules I maintain. I just haven't gotten to it, nor has anyone else submitted a patch.

I've tagged this as being a "novice" tag as it's actually quite simple to add a single (or two) extra meta tags to the module at this point: just decide whether they should go in the main module or a submodule, edit that module's "*.metatag.inc" file, scroll down to the hook_metatag_info() implementation, duplicate some of the $info['tags'] variables and tweak it accordingly, then upload the patch and collaborate with others in the community to make sure it works as intended. (I just posted a documentation with this info)

And yes, I could have written the patch in the time it has taken to write this, but I wanted to explain to you that everyone can help improve the module, and indeed Drupal as a whole, you don't have to sit waiting for someone else to do it. And you should definitely be patient with and respectful of those who pour tens and hundreds hours of their personal time into open source projects, rather than asking why something hasn't been done yet.

If you would like to try helping with this or any project, the first step is to learn how to write patches, then work with the issue queue to find issues you think you could help with, and collaborate to improve the patches sufficiently so that they may be marked as "Reviewed and Tested By Community" (i.e. "RTBC"); if you're interested you might try asking to help as a co-maintainer.

There are also people on IRC and local user groups that can help you learn to write patches, if you're unfamiliar with the process.

Thank you for collaborating with us :)

preshetin’s picture

Assigned: Unassigned » preshetin

Will try.

DamienMcKenna’s picture

@preshetin: Excellent, thank you! If you need help doing a patch you can catch me in #drupal-seo on IRC.

preshetin’s picture

Status: Active » Needs review
1.55 KB
PASSED: [[SimpleTest]]: [MySQL] 101 pass(es). View

In this patch I tried to implement #10 and documentation instructions.

It seems to me, that for submodule this feature is too small, so I added links to advanced section of main module.

Also the patch should not contain this:

old mode 100644
new mode 100755

So I will try to remove it.

It would be great to get feedback. I am a novice, so any feedback is welcome.

DamienMcKenna’s picture

Status: Needs review » Needs work

@preshetin: That's excellent, thank you!

The only thing that needs to be changed is the 'devel_generate' value, they should both have the 'type' of 'url' as they are both used to contain URLs. But otherwise it looks perfect!

preshetin’s picture

Assigned: preshetin » Unassigned
Status: Needs work » Needs review
1.53 KB
PASSED: [[SimpleTest]]: [MySQL] 101 pass(es). View
576 bytes

@DamienMcKenna: Thank's for feedback!

Here is updated patch with #14 corrections.

DamienMcKenna’s picture

Status: Needs review » Fixed

Thank you preshetin! Committed!

preshetin’s picture

DamienMcKenna, thank you for opportunity to participate in. I really enjoyed it.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

Kristina Katalinic’s picture

@preshetin can you please tell me which tokens do I have to use to get the rel=prev / rel=next meta tags for my dynamic paginated views? I tried adding token [metatag:prev] and [metatag:next] but that doesn't really result in any output :(

Thanks in advance

DamienMcKenna’s picture

Lets continue the discussion of using these with meta tags with Views in a new issue: #2502453: How to best use rel=next/prev in Views pages?

osopolar’s picture

Dieter Geiling’s picture

Same problem here! I still get no output.
Can anyone confirm that the rel=next/prev metatags works with views? Wich token are the right one for that?
Anyone know how to resolve the problem?

Thanks for idears

DamienMcKenna’s picture

@Dieter: Please continue the discussion in #2502453: How to best use rel=next/prev in Views pages?.

kappaluppa’s picture

Some FYI info about the prev/next links aside from reference to the modules. This does not relate directly to the modules, but may help others decide if they still need to classify their needs as a module issue:

@Kristina-Katalinic - You might want to take a look at these answers about using next/prev with dynamically loaded content... https://productforums.google.com/forum/?hl=en#!category-topic/webmasters...
"It's fine if your paginated content works like Google Image Search results where pagination doesn't create a new URL (so there's no way you can add rel="next"/"prev"), but instead dynamically loads content. However, you may want to make sure that Googlebot and users without JavaScript can still easily discover your content."

Although that answer is from 2011 I have not found anything else to the contrary. The biggest issue being that the URL does not change. If your URL changes with paginated dynamic content, then that's a different thing.

Sandbox project for link prev/next with views: ​https://www.drupal.org/sandbox/nlisgo/2361421 plus this patch to make it work with the metatag module: https://www.drupal.org/node/2613216#comment-10554518
I've tested it on a regularly paginated view and it worked for me.

elukacs’s picture

The pager_tokens module works well with Metatag. It provides the following tokens: