Add field formatter to view which metatags are being rendered

Created on 21 September 2020, almost 4 years ago
Updated 24 April 2023, about 1 year ago

Problem/Motivation

Currently, the metatags module provides a single field formatter which does not render anything. This makes sense since the module actually updates the <head> tag to fulfill its purpose. When initially setting the tag values, it might take some trial and error to get them properly configured. With the existing field formatter, users need to inspect the source code of the page to see which tags were added and what are their values. This process might be slow and a bit technical for some users. There are some browser extensions that expose metatag information, but availability varies widely among browsers. It would be ideal if the metatag module itself provided a field formatter to view which tags are being rendered.

Proposed resolution

Create a new field formatter that lists which tags are being rendered. This can be used temporarily in an entity's 'Manage display' section to debug the metatags configuration. When the entity is rendered, the list of tags will be rendered an text on the page.

Alternatively, create a tags explorer or developer tool to show what values are being rendered.

No matter the approach, consider using metatag_generate_entity_metatags($entity) to get the tags in a human readable structure.

Remaining tasks

Determine how to implement this feature request.

User interface changes

None.

API changes

None.

Data model changes

None.

✨ Feature request
Status

Closed: duplicate

Version

1.0

Component

Miscellaneous

Created by

🇳🇮Nicaragua dinarcon

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇺🇸United States bdanin

    This is useful for me. I need a view that shows all the posts/nodes and their respective meta description and titles. This is important for content authors looking at a bunch of posts. I have a view of several hundred blog posts, and we want to see their display titles, along with their authored meta titles and descriptions. This patch accomplishes this need.

    It would be great to see this adopted and added to the main module.

  • Status changed to Needs work about 1 year ago
  • 🇺🇸United States DamienMcKenna NH, USA

    I think we need to be careful around adding functionality that could cause confusion in the output.

    Some ideas for improving it:
    * Add an access check that requires the "Administer meta tags" permission, otherwise nothing is displayed.
    * Extend it to add an option to output all of the entity's meta tags, not just the values stored in the field.

  • Status changed to Closed: duplicate about 1 year ago
  • 🇺🇸United States DamienMcKenna NH, USA

    Let's consolidate efforts around this similar issue: ✨ Provide field formatter to output meta tags on-page, e.g. for use with Views (D9) Needs work

Production build 0.69.0 2024