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.
How to create metatags for pages resulting of Views module?
Comment | File | Size | Author |
---|---|---|---|
#32 | metatag-n1804356-32.patch | 10.74 KB | DamienMcKenna |
#31 | metatag-n1804356-31.patch | 0 bytes | DamienMcKenna |
#22 | metatag-n1804356-22.patch | 10.76 KB | DamienMcKenna |
Comments
Comment #1
couturier CreditAttribution: couturier commentedYou have to add a token to show each page. This can be done in Global settings. See this issue: http://drupal.org/node/1473422
Comment #2
sahuni CreditAttribution: sahuni commentedSorry, but your reply does not help me.
What are those Global Settings you're speaking of? from Views module? from Metatags module?
I looked long for each module but could not get a clue.
Comment #3
couturier CreditAttribution: couturier commentedComment #4
couturier CreditAttribution: couturier commentedNew update: work is going on today about this issue at http://drupal.org/node/1809652
Be sure to read that, because some changes are happening.
Comment #5
sahuni CreditAttribution: sahuni commentedThanks Couturier for your help.
Problem is that you are speaking only of title metatag.
I'd like to add all the metatags to a view, same as for a node : it means description and keywords metatags. Is not it possible?
Comment #6
DamienMcKenna@Sahuni: It depends on what you want to do:
What I'd really like to do is merge Dave's sandbox into the main module.
Comment #7
DamienMcKennaComment #8
sahuni CreditAttribution: sahuni commentedWell,
I don't use context module and I think it's too a big module to add. I have less than 10 views.
I'm not use to play with sanboxes and git, so not a welcome solution
in the French forum, someone said to use http://drupal.org/project/views_field. Seems odd.
Perhaps, I'll add metatags with code in preprocess treatment (I did that in D6).
But it would be fine to have a real possibility to have good SEO for views, with help of user interface.
Comment #9
alexweber CreditAttribution: alexweber commentedThe code here works pretty well, should help until this gets worked on: http://drupal.org/sandbox/davereid/1281614
Comment #10
RollWhisTler CreditAttribution: RollWhisTler commentedGit Noob here... i get an empty master branch there... how can i download the source from a branch?
Comment #11
DamienMcKenna@RollWhiTler: You probably just followed the instructions on the project's main page, right? You need to grab the 7.x-1.x branch:
git clone --recursive --branch 7.x-1.x http://git.drupal.org/sandbox/davereid/1281614.git views_metatags
Comment #12
Randy74158 CreditAttribution: Randy74158 commented@DamienMcKenna,
Hmm, this looks very complex to me. Maybe I will wait until it will be implemented to module.
Comment #13
aidanlis CreditAttribution: aidanlis commentedIs there support coming for http://drupal.org/sandbox/davereid/1281614 ?
Comment #14
couturier CreditAttribution: couturier commented@aidanlis That project is over a year old, and since then, Views has moved to core for D8. It seems to me that since time is limited for support for Meta Tags itself, it would be hard to find someone to continue working on this project to integrate the same things you can currently do in Meta Tags into Views.
Comment #15
WiredEscape CreditAttribution: WiredEscape commentedEasiest solution is to create a block view and place block inside regular node. Then set metatags on the node.
Comment #16
sahuni CreditAttribution: sahuni commentedand @WiredEscape, what would be the easiest way to do that?
Comment #17
couturier CreditAttribution: couturier commented@sahuni Under Structure > Blocks > Configure > Show block on specific pages > Only the listed pages = Add your node URL there for the block
Comment #18
sahuni CreditAttribution: sahuni commentedYes it's a good idea, thanks
Comment #19
Dave Reidhttp://drupal.org/sandbox/davereid/1281614 is now up to date and will likely either be promoted to a full project or merged as a sub-module here.
Comment #20
DamienMcKennaI'd definitely vote to add it as a submodule, similar to metatag_context. I also would recommend renaming the module to "metatag_views" to keep the naming consistent with other submodules.
Comment #21
hass CreditAttribution: hass commented++
Comment #22
DamienMcKennaHere's Dave's code from the sandbox renamed as metatag_views and provided as a submodule.
Comment #23
alexweber CreditAttribution: alexweber commentedI've been rolling with the sandbox code for a while now and it works as advertised!
Comment #24
DamienMcKennaThis patch needs a bit more testing.
Comment #25
Dave ReidNeeds to test:
Comment #26
agoradesign CreditAttribution: agoradesign commentedHi Dave,
I've revealed a problem: the current code only works with the default configuration, overrides will always be ignored.
The reason is, that the function call to metatag_metatags_view() does not provide a language code inside the $metatags array. It's directly starting with the keyed meta tags. But metatag_metatags_view() is expecting a language code as key in the top level of the array. Otherwise nothing will be found, and the default configuration for Views will be used.
I think, that a solution for this problem would perfectly accompany with fixing the missing translation support (see http://drupal.org/node/1773950)
PS: I should have mentioned that I'm using the latest dev of metatag including the Entity Translation related patch from http://drupal.org/node/1845326#comment-6973542. But when I look into the code of beta2, I can see, that it wouldn't work with that version either
Comment #27
Fred8 CreditAttribution: Fred8 commentedI have also around 10 Views generated pages that were lacking META-s. I solved this by using Simple Meta module. This module allows 3 basic tags to be overruled: Title, Description and keywords. I actually only use the first two.
So, now I have 2 META modules working together: the regular Meta Tags module that is used for nodes, and Simple Meta for Views pages. Whenever I need to edit Views META-s, I switch its special tab on, it appears at the left side of the screen, then I navigate to the page, click on the tab, edit it, and Save. After doing so, I disable the tab, as it's a little annoying, even though visible only to administrators.
Comment #28
Chris Burge CreditAttribution: Chris Burge commentedI am able to replicate the behavior @agoradesign describes.
<meta content="noindex" name="robots">
' should render in the page header but does not.Comment #29
Chris Burge CreditAttribution: Chris Burge commentedIn the interim, Views PHP offers a solution for this issue by way of the 'drupal_add_html_head' function.
In the long-term, a reworked patch from #22 #1804356-22: Views integration: option to add meta tags within the Views UI is a better solution; however, the code immediately above will work in the mean time,
Comment #30
hass CreditAttribution: hass commentedComment #31
DamienMcKennaThis fixes the issue that agoradesign mentions in #26 so it's now possible to actually override the values on each View.
Comment #32
DamienMcKennaDOH!
Comment #33
DamienMcKennaCOMMITTED!!! Thanks Dave!!!
All follow-up work should be in new issues.
Comment #34
DamienMcKenna1.0-beta6 is out, so I'm closing this issue in the interest of keeping the issue queue clean.