X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=web%2Fmodules%2Fcontrib%2Fmetatag%2FREADME.txt;fp=web%2Fmodules%2Fcontrib%2Fmetatag%2FREADME.txt;h=4f7da51328f716a509cbad0d5c2fe86b40478c85;hb=af6d1fb995500ae68849458ee10d66abbdcfb252;hp=aa82d891079175962226f90d1cbc8d151f16f1f0;hpb=680c79a86e3ed402f263faeac92e89fb6d9edcc0;p=yaffs-website diff --git a/web/modules/contrib/metatag/README.txt b/web/modules/contrib/metatag/README.txt index aa82d8910..4f7da5132 100644 --- a/web/modules/contrib/metatag/README.txt +++ b/web/modules/contrib/metatag/README.txt @@ -43,6 +43,9 @@ The primary features include: * The fifteen Dublin Core Basic Element Set 1.1 meta tags may be added by enabling the "Metatag: Dublin Core" submodule. +* Forty additional Dublin Core meta tags may be added by enabling the "Metatag: + Dublin Core Advanced" submodule. + * The Open Graph Protocol meta tags, as used by Facebook, Pinterest, LinkedIn and other sites, may be added by enabling the "Metatag: Open Graph" submodule. @@ -58,6 +61,9 @@ The primary features include: APIs, but they are not needed by most sites and have no bearing on the Open Graph meta tags. +* The Pinterest meta tags may be added by enabling the "Metatag: Pinterest" + submodule. + * Site verification meta tags can be added, e.g. as used by the Google search engine to confirm ownership of the site; see the "Metatag: Verification" submodule. @@ -95,7 +101,7 @@ Standard usage scenario automatically assign values. 4. Additional bundle defaults may be added by clicking on "Add metatag defaults" and filling out the form. -5. To adjust metatags for a specific entity, the Metatag field must be added +5. To adjust meta tags for a specific entity, the Metatag field must be added first. Follow these steps: 5.1 Go to the "Manage fields" of the bundle where the Metatag field is to @@ -130,17 +136,19 @@ Option 1: 'keywords' => 'Some,Keywords', ]), ]; - $node = \Drupal::entityTypeManager()->getStorage($entity_type)->create($values); + $node = \Drupal::entityTypeManager() + ->getStorage($entity_type) + ->create($values); $node->save(); Option 2: - $node = Node::create(array( + $node = Node::create([ 'type' => article, 'langcode' => 'en', 'status' => 1, 'uid' => 1, - )); + ]); $node->set('title', 'Testing metatag creation'); $node->set('field_meta_tags', serialize([ 'title' => 'Some title', @@ -154,6 +162,53 @@ values defined via the global defaults prior to being output - it is not necessary to copy each value to the new record. +Obtain meta tags for an entity +-------------------------------------------------------------------------------- +For developers needing to access the rendered meta tags for a given entity, a +function is provided to make this easy to do: + + $metatags = metatag_generate_entity_metatags($entity); + +This will return an array with the following structure: + + [ + 'title' => [ + '#tag' => 'meta', + '#attributes' => [ + 'name' => 'title', + 'content' => 'The What | D8.4', + ], + ], + 'canonical_url' => [ + '#tag' => 'link', + '#attributes' => [ + 'rel' => 'canonical', + 'href' => 'http://example.com/what', + ], + ], + 'description' => [ + '#tag' => 'meta', + '#attributes' => [ + 'name' => 'description', + 'content' => 'I can't even.', + ], + ], + 'generator' => [ + '#tag' => 'meta', + '#attributes' => [ + 'name' => 'generator', + 'content' => 'Drupal 8!', + ], + ], + ] + +The meta tags are keyed off the meta tag plugin's ID, e.g. "generator". Each +meta tag is then provided as arguments suitable for use in a render array with +the type "html_tag". Extracting the value of the meta tag will depend upon the +type of meta tag, e.g. the generator meta tag uses the "content" attribute while +the link tag uses the "href" attribute. + + DrupalConsole integration -------------------------------------------------------------------------------- Using the DrupalConsole, it is possible to generate new meta tags, either for @@ -179,9 +234,14 @@ Related modules Some modules are available that extend Metatag with additional or complimentary functionality: -* Schema Metatag +* Schema.org Metatag https://www.drupal.org/project/schema_metatag - Extensive solution for adding schema.org support to Metatag. + Extensive solution for adding schema.org / JSON-LD support to Metatag. + +* Context Metadata + https://www.drupal.org/project/context_metadata + Allow assignment of meta tags based upon different system contexts, e.g. per + path. * Real-time SEO for Drupal https://www.drupal.org/project/yoast_seo @@ -246,4 +306,4 @@ References 13: https://www.drupal.org/u/mikeyk 14: https://www.drupal.org/u/mr.baileys 15: https://www.drupal.org/u/nikhilesh-gupta -16: https://www.drupal.org/u/rakeshgectcr \ No newline at end of file +16: https://www.drupal.org/u/rakeshgectcr