Document Metatag's APIs and provide examples for:

  • Creating new meta tags.
  • Disabling meta tags provided by default by the module.
  • Adding meta tag support to new entities.
  • Loading meta tags for a given entity.
  • How to customize the form fields.

Original issue:
Any examples out there showing how to use the API to "define your own meta tags"?

Thanks!

CommentFileSizeAuthor
#12 metatag-n1466292-12.patch6.67 KBDamienMcKenna
PASSED: [[SimpleTest]]: [MySQL] 11 pass(es). View
#2 metatag-n1466292.patch216 bytesDamienMcKenna
PASSED: [[SimpleTest]]: [MySQL] 15 pass(es). View
Members fund testing for the Drupal project. Drupal Association Learn more

Comments

DamienMcKenna’s picture

Version: 7.x-1.0-alpha4 » 7.x-1.x-dev
Issue tags: +D7 stable release blocker

We need to fully document this for the 1.0 release.

DamienMcKenna’s picture

Status: Active » Needs review
FileSize
216 bytes
PASSED: [[SimpleTest]]: [MySQL] 15 pass(es). View

A placeholder so other issues have somewhere to add details to.

DamienMcKenna’s picture

Status: Needs review » Needs work

I've committed this file, but more work is needed.

silkogelman’s picture

Sweet, thanks!
I can't wait to define my own (Token based) meta tags.
Great stuff.

silkogelman’s picture

Example on how to create your own meta tags using Metatag module.
http://www.agileapproach.com/blog-entry/creating-custom-meta-tags-metata...

DamienMcKenna’s picture

Component: Miscellaneous » Documentation
Category: support » task

@s1l: Excellent post! Thank you!

DamienMcKenna’s picture

Title: Define your own meta tags » Document Metatag APIs, provide examples for creating new meta tags
Status: Needs work » Active
DamienMcKenna’s picture

DamienMcKenna’s picture

Marked #1308164: Documentation Please! as a duplicate.

DamienMcKenna’s picture

Issue summary: View changes

Clarified the issue.

DamienMcKenna’s picture

DamienMcKenna’s picture

Marked #1318182: Custom tags as a duplicate.

DamienMcKenna’s picture

Issue summary: View changes

Provided more details on what needs to be documented.

DamienMcKenna’s picture

Issue summary: View changes

Document how to customize form fields.

DamienMcKenna’s picture

Status: Active » Needs review
FileSize
6.67 KB
PASSED: [[SimpleTest]]: [MySQL] 11 pass(es). View

This is a starting point, all new hooks are at least added to metatag.api.php and everywhere the hooks are triggered there's a comment to say what the hook name is.

DamienMcKenna’s picture

Status: Needs review » Needs work

I've committed #12 to keep the ball rolling, but it needs further work.

DamienMcKenna’s picture

RTFM, manual, readme, help, ponies.

To help people find this page via the issue search. ;)

remkovdz’s picture

Is it already possible to make a field (eg Description) required and if so: can anyone help me with it? I'm not a very experienced coder...

Dubs’s picture

Please can you quickly explain how to load meta tags for an entity (including any defaults setup)?

I've tried metatag_metatags_load, but this doesn't seem to work :-(

DamienMcKenna’s picture

Status: Needs work » Active
DamienMcKenna’s picture

Title: Document Metatag APIs, provide examples for creating new meta tags » Document all Metatag's hooks

Lets keep this issue focused on documenting the new hooks, leave #1858116: Document how to use Metatag's functions to manage using Metatag's funtions for other uses.

escoles’s picture

Re. #5: Can someone please confirm that the proper procedure for adding a metatag, to be managed via metatags module, is to write a module?

escoles’s picture

Issue summary: View changes

Added the question of one of the issues that was marked as duplicate.

DamienMcKenna’s picture

Issue summary: View changes
Issue tags: -D7 stable release blocker

Some documentation was added recently, taking this off the blockers list and will work on it further post-1.0.

DC_Marc’s picture

Can you provide an example on how to trigger your metatag_presave hook? Saving a node with metadata doesn't seem to do it, at least based on my dsm calls. And is the documentation for this hook missing a $language parameter (based on the .module file around like 415 as of beta7) of the function?
Thanks!
Marc

  • DamienMcKenna committed 52b1a14 on 8.x-1.x
    Issue #1466292 by DamienMcKenna: Placeholder file for documenting the...
  • DamienMcKenna committed a908959 on 8.x-1.x
    Issue #1466292 by DamienMcKenna: Listed hooks in metatag.api.php and...
alvar0hurtad0’s picture

Here's a related issue:

#2678004: Complete api documentation

Maybe one can be marked as duplicate.

Devaraj johnson’s picture

Is there any way to make the Meta description field mandatory and limit the field to number of char(160 max) and accordingly change the meta description field description.

Any help will be really useful. Also if we can document it in this page it self it will be great.

https://www.drupal.org/project/metatag/issues/1391968#comment-7291458

https://www.drupal.org/project/metatag/issues/1466292#comment-6874960

I see few folks are also trying to get the answer.

DamienMcKenna’s picture