Needs work
Project:
Metatag
Version:
7.x-1.x-dev
Component:
User interface
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
3 Mar 2013 at 16:27 UTC
Updated:
30 Oct 2019 at 15:09 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
dave reidWe have this request in Pathauto and it's very hard to do once you add in entities that have not yet been saved or properly constructed into an object, and tokens like [current-page:*] which don't actually reflect the real way the meta tags would be viewed.
If we wanted to do something like the upcoming Views metatag module and insert a 'preview' of the metatags when the user actually hits the 'Preview' button on the node, that is something reliable we can use.
Comment #2
benjifisherI was asked for this feature on a site I maintain. I am planning to implement an un-ambitious version: "Preview unavailable" when adding a new node, but the preview will be generated when you save and then edit the node. If it is not much harder, then I will make it work on Preview.
Does that sound good enough to include in the Metatag module? If so, then I will hack my copy of the module and submit a patch instead of using
hook_form_alter()from a custom module.Comment #3
benjifisherI have attached a patch.
As I said in my first comment, it is not very ambitious:
[current-page:*]tokens.The main reason for the second point (other than "good enough for my current client") is that I know I can get the node object from
$form['#node'], and I am not sure what to do in general.Comment #6
benjifisherThank you, testbot! Here is a version that does not save previews in the database.
Comment #7
damienmckennaThis is an interesting idea, but it needs some work. At a basic level I would recommend doing the following:
Comment #8
benjifisherHere is an updated patch.
$form['#entity']and$form['#entity_type'].admin/config/search/metatags/settings(under "Additional settings", which used to be a lie because there was only one) to leave tokens like[current-page:pager]unprocessed or to strip them. By default, it leaves them in.Thanks to the last item, I no longer have to hack the javascript to avoid polluting the vertical tab's label, and I no longer need extra code to avoid saving the preview in the
metatagtable.Comment #9
damienmckennaI'll need to look at this and consider whether we want to take this approach or just try to do a real AJAX-driven preview.
Comment #10
damienmckennaThis needs usability work. I think we need to go back to using an AJAX structure for doing the previews, especially when not all entities support a "preview".
Comment #11
benjifisherIs anyone actively working on an AJAX implementation? If not, then maybe you are letting the perfect be the enemy of the good. You could include the working, good but not perfect patch now and revert it when you come up with something better.
The patch I proposed is better than nothing. I have one happy client. The patch works with various entity types, and it works with previews.
Disclosure: I have an interest in getting this issue resolved before the next release of the module, since it will make it easier to maintain my client's site.
Comment #12
damienmckenna