Closed (fixed)
Project:
Metatag
Version:
7.x-1.0-beta6
Component:
Code
Priority:
Critical
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
9 May 2011 at 19:00 UTC
Updated:
18 Apr 2013 at 15:27 UTC
Jump to comment: Most recent file
Comments
Comment #1
bryancasler commentedsubscribe
Comment #2
quantos commented+1
Comment #3
leendertvb commentedsubscribe
Comment #4
BenK commentedSubscribing
Comment #5
Ankabout commentedSubscribing.
Comment #6
dave reid.
Comment #7
dave reidComment #8
dropbydrop commented+1
Comment #9
dave reidI started a sandbox module for this at http://drupal.org/sandbox/davereid/1281614. Use at own risk for now. Requires latest Views 7.x-3.x-dev.
Comment #10
Ankabout commentedI'll try it out and report back Dave.
Comment #11
dave reidRemoving blocker tag.
Comment #12
ceefour commented+1 for this!
BTW, what is the workaround until this feature is ready .... ??
Comment #13
Coupon Code Swap commentedA question on Views integration. Will taxonomy meta tags be supported with taxonomy term views in the same way that they are for the regular Drupal taxonomy term pages? I have added meta tags for each term and would like to be able to utilize these for the title etc. in the overridden taxonomy term view.
Comment #14
lsolesen commentedI tried the sandbox project - however, as far as I can tell the metatags are not added to the html output. However, the ui seems to work smoothly.
Comment #15
maximpodorov commentedThis code works for views serving taxonomy term pages:
Comment #16
facine commentedFor multiple taxonomy views:
Comment #17
maximpodorov commentedIs it possible to include taxonomy term view support into official Meta tags project?
Comment #18
Jorge Navarro commented+1
Comment #19
quasi commentedSecond the taxonomy view support. Thank you!
Comment #20
Ankabout commentedDave, I haven't tried this yet, since someone said it doesn't add the html anyways, but maybe you can answer.
Can I use replacement patterns from views in the meta tags? It would be good if you have some sort of contextual filter (based on a field) and if you're able to use the information from the view in the tags.
I'm not a coder, so I'm not sure how hard this would be, but I can't be the only one hoping for this functionality. The problem I see however is that views seems to always be passed after the head is parsed and printed. Or am I wrong in that?
Comment #21
jeff.maes commentedNice one!
I've created a patch of #16 - All credits should go to maximpodorov and facine.
Comment #22
Jorge Navarro commentedthe patch is fixing the problem only for taxonomy, for page views there is no change.
Comment #23
selinav commented+1,
I've a view page of my products, how to assign meta ?
Comment #24
keesje commentedpls look at http://drupal.org/node/1594352
Comment #25
dave reidI would really prefer that people continue to check out http://drupal.org/sandbox/davereid/1281614 and head in that direction rather than the patch in #21.
Comment #26
Ankabout commentedCan you elaborate why the sandbox solution is better or why you prefer it? A short explanation would be good for people finding this thread for the first time, or for those like me that just don't get it because of lack of caffeine...
Comment #27
artis commentedDave, while you are elaborating on Ankabout's question could you also touch on the difference between your sandbox module and ribakker's sandbox module? It would be nice to get one of the two sandbox modules committed to the Metatag module, but with 3 different directions that doesn't seem likely with out some sort of comparison.
Thanks.
Comment #28
voodootea commentedhttp://drupal.org/node/1151936#comment-6037226
the sandbox project is not available, or is just a folder without the module code?
I've fetched it using
git clone http://git.drupal.org/sandbox/davereid/1281614.git views_metatagsusing command line, however it only contains a bunch of empty folder,, the readm file just says 'Master branch is empty.'
Any ideas??
many thanks D
Comment #29
rooby commentedTry
git clone --branch 7.x-1.x http://git.drupal.org/sandbox/davereid/1281614.git views_metatagsComment #30
selinav commentedI try to test views_metatags of davereid and I've the error message in the metatags settings
The Description is using the following invalid tokens: [view:description].
The Titre is using the following invalid tokens: [view:title].
The URL canonique is using the following invalid tokens: [view:url].
Even if, I override token by text, meta are not displayed in the view page.
Comment #31
ordermind commentedI have just uploaded a sandbox module at http://drupal.org/sandbox/ordermind/1623122 which includes a version of views_metatags that is mostly working. It also provides some useful improvements on the original metatag module.
Comment #32
nocean commented#15/16 worked great for me. @Dave, I tried to test out your sandbox project, but had trouble -- eventually running up against a 500 error on Drupalcode.org.
Comment #33
norio commentedI tested ribakker's sandbox and davereid's. Dave's uses invalid tokens, so doesn't work, and ribakker's LOOKS like it will work but no actual meta tags are added to the view.
If I had to choose, I'd definitely say ribakker's is the way to go as Dave's uses the view description which, if I'm not mistaken, is there for the admin's use, not for public view. This adds work as you have to go and edit the description of all the default views in your site to remove the developer's description of the view and add your own, SEO-friendly version.
Comment #34
gebiss commentedThe patch #21 works but it generate error on multilingual taxonomy:
Notice: Undefined index: language in metatag_field_attach_view_alter() (line 458 of /home/cms/public_html/CS/sites/all/modules/metatag/metatag.module).
Jacek
Comment #35
danielcristian89 commentedI just add a mini if to stop generate that problem. If somebody has a better ideea for it pls let me know
$context['language'] = isset($context['language']) ? $context['language'] : '';
Comment #36
nocean commentedThanks Daniel, that cleared up the PHP notice for me too.
Comment #37
gebiss commenteddanielcristian89, where did you add this code?
Comment #38
danielcristian89 commentedComment #39
trunghaiy commentedI have same errors with #30 when use views_metatags!
Comment #40
dropbydrop commentedsame problem here
Comment #41
csc4 commentedJust wanted to say thank you to danielcristian89 the code in #38 was a massive help for a project I 'm working on
Comment #42
gebiss commentedThanks danielcristian89 for the solution #38. It helped
Comment #43
trunghaiy commentedThanks #38 but #38 will not work if you use Taxonomy Term Views with Allow multiple values , it will make error
EntityMalformedException: Missing bundle property on entity of type taxonomy_term. in entity_extract_ids() (line 7539 of /includes/common.inc).
You should check if term id is number to avoid this error :)
Comment #44
maximpodorov commentedHow is it possible to assign metatags for multiple term page? Maybe first term's metatags is the best solution?
Comment #45
trunghaiy commentedHi maxim,
I don't think it is best solution, it will duplicate meta tag with other term.
In my case, I avoid use multiple term and changed from multiple term to hierarchy term and use DefaultContextual Filter of Taxonomy Term Views.
Comment #46
summit commented@trunghai, can you explain this in code please? Thanks a lot in advance! Greetings, Martijn
Comment #47
trunghaiy commented@Summit, I just config Views not code :)
My taxonomy term is:
Toy
--Barbie (tid = 1)
--Auldey (tid = 2)
--Vikings (tid = 3)
.....
--Fischertip (tid = 4)
--Fischertechnik (tid = 5)
I used taxonomy term to group terms 1, 2, 3 is Funny Land toy; 4,5 is smart toy and used Views taxonomy term to create mysite/taxonomy/term/1,2,3 and mysite/taxonomy/term/4,5.
But my site have bug #43.
Now, I create new terms and revert view Taxonomy term to default and change Depth to 1.
Toy
-Funny Land
--Barbie (tid = 1)
--Auldey (tid = 2)
--Vikings (tid = 3)
.....
-Smart toy
--Fischertip (tid = 4)
--Fischertechnik (tid = 5)
Comment #48
maximpodorov commented@trunghai, what's your suggestion of combining metatags for the pages like 1+2+3 or 1,2,3?
Comment #49
osysltd commented#21 Works fine except exposed filters.
EntityMalformedException: Отсутствует связующее свойство у сущности типа taxonomy_term. в функции entity_extract_ids() (строка 7539 в файле public_html/includes/common.inc).
Comment #50
osysltd commentedMore reliable variant of #21 Does not throw exceptions as described in #43 when Exposed Filters are applied.
Comment #51
adelka commentedsubscribe
Comment #52
smitty commentedThis works fine for me. Except the php-error: "Notice: Undefined index: language in metatag_field_attach_view_alter() (Zeile 440 von www.myserver.com\sites\all\modules\metatag\metatag.module)."
This can be fixed by adding
previous to metatag_field_attach_view_alter.
Comment #53
agoradesign commentedCall me pedantic, but plz do not use 'und', use LANGUAGE_NONE constant instead:
$context['language'] = LANGUAGE_NONE;ref: http://api.drupal.org/api/drupal/includes!bootstrap.inc/constant/LANGUAGE_NONE/7
Comment #54
smitty commented@agoradesign: good catch!
@all: Found a small bug: If using the token current-page:page-number for displaying a page-number in the title, all pages of the view get the same number.
Seems to be a caching problem. If switching off caching in metatag_field_attach_view_alter the page-numers are correct.
How can we tell metatag_page_alter not to cache the taxonomy term views pages metadata?
Comment #55
jackhutton commentedimplementing solution outlined in #38 .. works for me thank you danielcristian89
subscribing.
Comment #56
Jorge Navarro commentedNot working after alpha8
Comment #57
NikGleb commentedThis much-needed patch simply must be included in the core of the module.
Dear Dave Reid, we look forward to you!
Comment #58
facine commentedComment #59
hdennen commented#50 is working form me (almost completely) in a custom module, #58 not at all.
The only problem with #50 is that I'm still not pulling og:image from a taxonomy view. Not sure what's going on; if I use [field_image:file] I can pull the file name, just not the path to it. weird.
Comment #60
damienmckennaI'll review this prior to the next beta.
Comment #61
damienmckennaLets get this back to ensuring that the core entity pages still work correctly when using Views as the display engine, we'll leave Dave's sandbox as the starting codebase for adding Metatag functionality directly inside the Views UI.
Taxonomy term pages should work once the core patch from #1067120: Missing hook_taxonomy_term_view() or hook_entity_view() when viewing a term is committed, so I'm not in favor of adding more hacks until deemed absolutely necessary once other normal hooks are not working.
Has anyone tried using Views for displaying nodes, did Metatags work with that scenario?
Comment #62
damienmckenna(yes, I hijacked the issue.)
Comment #63
damienmckennaThis is needed for the 1.0 stable release.
Comment #64
damienmckennaRelated: #1760494: Allow the page title to be not assigned if it has the value "<none>"
Comment #65
damienmckennaTest scenario #1:
So, the page title still does not work correctly, even if Views is set to not output the title.
Comment #66
vood002 commentedAm I missing something here? Trying to use code from #50, getting error
Fatal error: Call to undefined function metatag_field_attach_view_alter() in /var/www/drupal7/sites/all/modules/custom/siena/siena.module on line 425Assuming this is calling an implementation of hook_view_alter()? If that's the case what is the metatag_field_attach module? Is this one of the sandbox projects mentioned above?
Comment #67
damienmckennaThe code snippet above won't work as it depends upon code that has since been removed from Metatag.
Comment #68
bartclarkson commentedHonestly, I just needed the metatags to act more like fields, both for internal site searching and a Views feed that allows another site to selectively synchronize nodes, and to that end, I employed the Computed Field module. For the Computed Code (PHP), I added this for a computed field I called meta_description.
I did another for $output['keywords'];
I figure the beauty of it is that when we get a production-grade solve, I can just drop off the computed fields without much heartache.
Comment #69
damienmckennaI think #1784896: Overriding meta tags fall back to parent default tag value will resolve this.
Comment #70
colanNope. None of my global tags are showing up on Views pages with that patch.
Comment #71
damienmckennaThis is a must-have item for 1.0.
Comment #72
maximpodorov commentedI created new project http://drupal.org/project/metatag_term_view with the following code for view-based taxonomy term pages:
It works for me with new dev version of Meta tags module.
Comment #73
damienmckennaI'm not sure when I'll get to it, so could someone please test the current -dev version of Drupal core along with the current -dev version of Metatag and let me know if the combination work for term pages? It should.
Comment #74
damienmckennaI can confirm that with the current -dev codebase and the latest D7 -dev release, that Views taxonomy term pages do not work. Bummer.
Comment #75
maximpodorov commented@DamienMcKenna, could you try my module (http://drupal.org/project/metatag_term_view)?
Comment #76
damienmckennaI've built a patch for Views that triggers hook_entity_view (thus allowing Metatag to work) when the current View's path matches an entity's path: #1809862: Trigger hook_entity_view on entity view pages; I'm awaiting feedback to let me know if this is the correct approach to take, or if I'm going in the wrong direction and should implement something in Metatag.
Comment #77
damienmckenna@maximpodorov: The goal is for this to work out of the box, lets wait for some feedback on the Views issue and we'll see what needs to be done.
Comment #78
damienmckennaThis is based on maximpodorov's code and works for all meta tags except the page title, which is being controlled by Views.
Comment #79
1mundus commentedConsidering that D 7.16 is a security maintenance release, will this patch wait until 7.17 to be commited or we can use it in the next dev version?
Thank you for your reply and efforts to implement it!
Comment #80
damienmckenna@1mundus: Which patch? The only core patch mentioned here is in the current drupal-7.x-dev codebase and will be in the 7.17 release soon. The other patches mentioned here are for Metatag or Views, none of which have been committed yet.
Comment #81
1mundus commented@DamienMckenna
Your patch from your previous post :) That patch should fix the issue with views pages, right?
After all that I have read about this issue, we are waiting until Drupal core bug gets fixed until you can commit this one, or?
Comment #82
damienmckenna@1mundus: The patch in #78 does not depend on any changes to core or Views.
Comment #83
1mundus commentedExcellent, I will test it in the following days.
Comment #84
Lostmonkey commentedShould the patch in #78 also work for 7.x-1.0-beta1? I have tried applying it with no luck.
Comment #85
maximpodorov commentedI confirm patch #78 can be applied to 7.x-1.0-beta1 and the resulting code produces meta tags on my view pages. Hip-hip-hurrah!
Comment #86
Lostmonkey commentedMade a mistake. Yes the patch work.
Comment #87
damienmckennaIn hindsight, I think that if Views won't be updated to fix this problem internally, that it should be handled via custom Views hooks rather than having any effect on other page requests.
Comment #88
damienmckennaPer #1819670: Global Frontpage Page Title not working when using a view to display content on frontpage. (closed as a duplicate), the page title not working is a problem :-\
Comment #89
ultimikeThe patch in #78 worked for me with beta1 as well.
Thanks,
-mike
Comment #90
Drupal Centric commentedThe patch in #78 worked for me to thanks.
Comment #91
damienmckennaHow would this work instead?
Comment #92
damienmckennaThis is a little better - instead of triggering all entity_view hooks it just runs metatag_entity_view().
Comment #93
damienmckennaUpdated to only run the custom logic on Views pages rather than on all views.
Comment #94
damienmckennaFYI the code in #93 is generic that will work with all entity types, not just taxonomy terms.
Comment #95
damienmckennaCommitted! Thanks for everyone's help!
Comment #96
maximpodorov commentedExcuse me for the stupid question. What is the best way to attach metatags to a entity-like page generated by a view if the path of this page is not the standard path for that entity?
Comment #97
facine commented+1 -> What is the best way to attach metatags to a entity-like page generated by a view if the path of this page is not the standard path for that entity?
Comment #98
damienmckennaThis has been released in 1.0-beta2: http://drupal.org/node/1826908
Comment #99
osysltd commentedHey! Beta-2 Is still pushing errors like
EntityMalformedException: Missing bundle property on entity of type taxonomy_term. in entity_extract_ids() (line 7562 of /home/web/www/includes/common.inc).with exposed filter rather #50.Comment #100
damienmckenna@osysltd: Please open a new issue for this and describe the view's configuration so that I can best understand what might be going on. Thanks.
Comment #101
damienmckenna@facine: please follow #1837660: Integration with Metatag.
Comment #102
shoufeng.xi commentednot work with TVI
Comment #103
damienmckenna@shoufeng.xi: Please open a new issue for that.
Comment #103.0
damienmckennaYes, I'm hijacking the issue.