Closed (fixed)
Project:
Meta tags quick
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Issue tags:
Reporter:
Created:
3 May 2011 at 20:17 UTC
Updated:
18 Apr 2012 at 11:44 UTC
Jump to comment: Most recent file
Comments
Comment #1
valthebaldNot sure I understand your idea. At which admin screen do you want to place these path-based meta tags?
Comment #2
john.oltman commentedI think he means a new admin screen. I have a module that is mostly done (metatags_extra) that does most of it. I'll post it soon, have some of my own site-specific code i need to isolate out first.
Comment #3
valthebaldcompletely new module? or you want to integrate?
Comment #4
john.oltman commentedHere's the module, it supports global default meta tags for non-node paths, global keywords for nodes, the option to default node description to the node teaser it it exists as a separate summary and there isn't already a meta description, and path-specific keywords and description for non-node paths. It would be nice to have it be a separate module inside the quick folder, so that it downloads with quick, but you can choose not to enable it, similar to the ways Views and Views UI works etc. That way if you only require the node tags that quick provides, you don't add overhead to your site.
Two things need to happen from here:
* Right now you have to hand code SQL to insert rows into the metatags_extra table, one for each non-node path for which you want override tags. I only have a few such paths on the site that I needed overrides for, so coding a few SQL statements was cake, but someone should code up a Drupal admin screen similar to String Overrides so you can use an interface instead.
* Ideally, the admin screens for this module are somehow combined with quick (not the module, just the links to the extra settings pages) so that there aren't separate links within the Structure page, one for quick, and one for extra. There should probably just be a single link on the Structure page named Meta Tags that brings up a page that links to both or has field sets for both.
If people like this direction, then I may have some time to do this within the next few days, or if someone else wants to have at it, go for it. Just let me know so we aren't duplicating efforts.
Comment #5
valthebaldThanks John,
I will look at the code later tonight
Comment #6
valthebaldHi john,
I have reviewed your code.
In general, I think it's a good idea to provide optional meta management for pages that do not represent single entities (like views, node etc.)
Your code supports only keywords and description meta tags, because these are hard coded fields in metatags_extra table. Probably it's better to take field list from field instances, and store meta data in rows like field_id = field_value
Comment #7
john.oltman commentedYes, supporting any meta fields would be better. I'll see about generalizing it, in the meantime, the module could get someone by in a pinch. Also, anything node related should probably be moved into quick, so that extra is just for non-node tags.
Comment #8
valthebaldWhat about the following schema (metatags_extra.install)
?
With such schema, you can handle all installed meta fields.
In edit screen, you can jusr retrieve all fields handled by metatags_quick module.
Comment #9
dave reidTreading more and more towards metatags.module functionality...
Comment #10
valthebaldShow me the code, Dave :)
Comment #11
dave reid@john.oltman: You may be interested in subscribing to #1151926: Allow meta tags to be assigned to custom paths which is the planned feature in the Meta tags module. This is possibly out of scope for the metatags_quick module. I'm also wondering what you use case is for custom paths that integration with Views or Panels wouldn't solve - in which case you also may want to track the following Meta tags issues: #1151936: Ensure Metatag works OOTB using Views to display Drupal core's entities and #1151938: Panels integration - meta discussion.
Comment #12
john.oltman commentedThanks Dave, I will subscribe to those issues. Apart from entities, views and panels, I see the following use cases for meta tags:
* Front page - many sites have a custom front page that isn't a node
* Custom module pages - many sites use custom modules that expose pages - these require tags
* Global default keywords (ideally, could be different for each of entities, views, panels, custom paths)
* Ability to default node meta description to the node teaser
I am launching a D7 site this week (D5-to-D7 conversion) that requires all of these, therefore I cannot wait for the real meta tags module. Also, while some "legacy" custom modules can be discarded in favor of views and panels, in other cases it is more straightforward and therefore less risky to simply update the module code to the new D7 APIs. The need for "custom path" meta tags is very real and very important for these types of sites. I definitely understand why you would focus on the 80% case, so there may yet be a need for a supplemental module to cover the 20%.
Comment #13
valthebaldHi John,
do you still plan to implement metatags_extra module? What is its status?
Comment #14
john.oltman commented@valthebald, I was waiting to see how things were shaking out with metatags_quick and some of the other issues. Would you still consider it worthwhile if I do the following:
* Move the node features of "extra" into "quick" (global node keywords, optionally use summary as meta description)
* In "extra", implement non-node path tags for meta keywords and description only, with global defaults (using my hard coded table structure), including an admin screen.
Your comments in #8 make sense, but I don't think I have the time for that, and it may be duplicative of what the real meta tags module will eventually provide.
If you want to move forward, let me know if you want this as a Git patch, or want to make me a co-maintainer. Whatever you prefer. Thanks again for your work on this module, very much appreciated by all.
Comment #15
valthebald@john.oltman thanks for warm words!
I needed some time to think about your suggestion, thus a delay...
I think that there is a need in path-based meta tags.
However, I am not sure how they would coexist with entity-based meta tags.
I think that correct and consistent way is to link paths or path aliases with existing fields.
Thus it's possible to solve several problems:
Hard-coding 2 possible meta tag types may solve this moment's need, but I think that with (not huge) additional effort we can get much better solution. Keep in mind that in any case metatags_extra code needs some work to accomplish. In fact, without that change metatags_extra is more of another solution to the meta tags problem, not an addition to metatags_quick (which is absolutely fine, by the way).
Are you ready to make that effort?
Comment #16
rovoI agree, this is definitely a much needed feature addition for those very reasons:
Comment #17
john.oltman commentedSorry for the delay - yes @val, I'll try your approach, perhaps it will be easier than I am thinking. I'll start on it within the next couple of days and hope to have something to you by June 1.
Comment #18
valthebaldGreat, @john.oltman!
If you want to discuss details or other help from me - let's meet in IRC
Comment #19
JohnnyX commentedI'm searching for a possibility to add keywords and description also to views. It seems metatags_extra is the solution for me? :)
Comment #20
valthebald#19: yes, definitely.
Comment #21
john.oltman commentedOk @valthebald, here you go. The patch adds defaults for node pages to meta quick; the node defaults are specific to description and keywords. These have to be hard-coded for those meta names because the functionality only applies to those tags (similar to how you hard code the basic meta tag fields if none exist). The revised metatags_extra module handles the meta tags definition and defaulting of non-entity paths for all meta tags defined in the installation; all the node related functionality is moved into the meta quick patch. I adopted some elements of your generic field schema, although I had to retain a serial number to make the editing work. I removed the foreign key to the url_alias table, as the non-entity paths do not generally appear in that table.
There is a new admin screen that allows administrators to inputs paths and the meta tags for those paths. The paths are checked to ensure they are existing internal non-entity paths. The display is similar to the URL alias admin screen.
Comment #22
valthebaldCool. Got homework to do :)
Thanks!
Comment #23
valthebaldJust rolled out 7.x-1.8 to fix project state before adding new features.
Git rocks!
Comment #24
john.oltman commented@valthebald, fyi, the most recent metatags_extra module in #21 has this warning:
PHP Warning: Call-time pass-by-reference has been deprecated in /var/www/html/sites/all/modules/metatags_quick/metatags_extra/metatags_extra.module on line 25
You'll need to remove the unnecessary ampersand from that line of code.
Comment #25
valthebaldHey guys,
I'm glad to announce that path-based meta tags are working.
I have taken original code of john.oltman from #21 and added it (with modifications) to the main module tree.
Due to the large number of changes, I think it's worth starting new series.
So please welcome first working release of 7.x-2.x branch.
Matter of change: hook_page_build checks either we build (fieldable) entity page (node, user etc.), or not
If fieldable entity detected, regular Fields API is used.
If not (default front page, views page etc.), module retrieves path-based tags
Comment #26
john.oltman commentedGetting this on a view when submitting a keyword and description, I'll see if I can dig into it more later and come up with a fix, but wanted to put this out there:
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'archive%2F201104-en' for key 1: INSERT INTO {metatags_quick_path_based} (lang, path, fid, value) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3); Array ( [:db_insert_placeholder_0] => en [:db_insert_placeholder_1] => archive%2F201104 [:db_insert_placeholder_2] => 8 [:db_insert_placeholder_3] => more desc ) in metatags_quick_admin_path_submit() (line 170 of /var/www/html/sites/all/modules/metatags_quick/metatags_quick.admin.inc).
Comment #27
valthebaldI guess you've downloaded it from releases link? It takes some time for d.o. to put latest commits into tarballs.
You can get latest version via git
Comment #28
michèle commentedHi valthebald
Many thanks!
Unfortunately I get the following error, when I try to update to version 7.x-2.x-dev:
PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table '24362_drupal7.metatags_quick_path_based' doesn't exist: SELECT pv.fid AS fid, pv.value AS value FROM {metatags_quick_path_based} pv WHERE (lang = :db_condition_placeholder_0) AND (path = :db_condition_placeholder_1) ; Array ( [:db_condition_placeholder_0] => de [:db_condition_placeholder_1] => admin/modules ) in metatags_quick_page_build() (line 196 sites/all/modules/metatags_quick/metatags_quick.module).I did not unistall the version 1.8 before, because I am not shure, if my meta tag fields are remaining in the database...
I'm looking forward to use the new path-feature! :-)
Regards, Michèle
Comment #29
valthebaldUpgrade from 7.x-1.x to 7.x-2.x should be smooth.
metatags_quick_path_based table should be created by database update script, did you run update.php?
Comment #30
michèle commented@valthebald
you're right - all works fine after running update.php. sorry for this... i think i had a too short night yesterday... ;-)
best regards, michèle
Comment #31
michèle commentedSorry to bother you again, Valery...
In the meantime, I successfully have installed the alpha1 version of your module.
I can see the path to the meta tags quick configuration page (/admin/config/search/metatags_quick), but I can't see any message about the path dependent meta tags.
After scanning your module code, I realized that the correct URL to insert the path dependent meta tags is i.e. /admin/config/search/metatags_quick/path/news for a view which creates a page with the path /news. After filling out the little form, the entered values are stored in the table metatags_quick_path_based, but instead of the path "news", the word "path" is saved inside of the path field... If I change "path" to "news", all works like a charm.
Am I missing something, or is the admin backend for path dependent meta tags not yet supported by the alpha version of the 2.x branch? (which certainly would not be any problem - I'm really happy that it works even if I have to hardcode it inside of the database table! :-)
Many thanks again
Michèle
Comment #32
JohnnyX commentedI installed the alpha. There seems no admin backend buut you should see a "Edit meta tags" link if you display the page (frontend) in the tabs. Here you can set description and keywords
Comment #33
michèle commentedThanks JonnyX. Your're right! I've searched through the whole admin backend, but in the end, the solution is so obvious... ;-)
Comment #34
valthebaldReally nice to see other people helping to each other! Keep that way!
Comment #35
JohnnyX commentedMh, I set keywords and description at a view. Values saved and there but I don't can find the meta keywords and descriptions in source code... Maybe a bug? Cache cleared some times. Caching at views configuration was disabled.
Comment #36
valthebaldWorks much better in alpha4 - tested for views, nodes, taxonomy terms and front page + multilingual support
Comment #38
tomsherlock commentedLooking at the UI, it is not clear to me how I associate a meta tag with a path.
Under configuration, I've already selected Description and Keywords for path based meta tags. I see the tab for managing fields and I know when I look at content types I can add meta tags. Also when I edit a particular tag I can see the keywords field and description field. What am I missing?
BTW, you might want to consider changing the default labels to something like meta keywords and meta description to avoid name clashing.
Thanks for your efforts. This module is much appreciated.
Comment #39
tomsherlock commentedHow do you test for Views?
I only see:
Comment
Path-based meta tags
Node
Taxonomy term
User
listed on the config page.
Under manage display I see: "Use custom display settings for the following view modes". Should I be seeing a list of Views below that sentence?
BTW, you might consider adding a config link from the modules page as well.
Comment #40
valthebaldFirst, please open new issue in separate issue (sorry for truism) - this thread is closed
Second, if you enable path-based meta tags, you will see 'Edit meta tags' link on the views page (important - not in the views edit screen!). Probably this should be addressed in documentation, but I'd like to finish functionality first
Comment #41
drupalpal commentedThe most important thing is to remember to create and attach path based meta tags first from /admin/config/search/metatags_quick, just in case someone is struggling to get this working.