Default Metatags aren't outputted in JSON:API

Created on 31 August 2023, over 1 year ago

Problem/Motivation

When using "Metatag defaults", these values are not being outputted to the metatag array when getting data through JSON:API.

Steps to reproduce

  1. Install JSON:API core module (+ configure so you can access node info via JSON:API)
  2. Install Metatag module
  3. Add a Metatag field (field_metadata) to the "Basic Page" content type (so metadata can be overridden on a node)
  4. Create a new Metatag defaults set for "Content: Basic Page"
  5. Set the "Title" tag to any value
  6. Create a new "Basic Page", leaving the Metatag info empty (defaults)
  7. Notice that in JSON:API, the metatag value results in an empty array
  8. Go and edit or create a new node, populating values for "title" metatag
  9. Notice that in JSON:API, the metatag value is populated

Proposed resolution

If metatag values are not overridden by an entity, the defined "Metatag defaults" for that entity should appear in JSON:API metatag array.

Previously this was working for me using Metatag 1.22 with this patch β†’ , but moving to Metatag 2.0 seems to no longer work.

Potentially a separate issue: I'm also noticing that Metatag defaults don't pre-populate those default values on Node forms anymore. Used to pre-populate in 1.x (potentially related to #1798984)

πŸ› Bug report
Status

Closed: cannot reproduce

Version

2.0

Component

Integration with other module

Created by

πŸ‡ΊπŸ‡ΈUnited States Nuuou Lincoln, NE

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

Comments & Activities

  • Issue created by @Nuuou
  • Status changed to Closed: cannot reproduce over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States Nuuou Lincoln, NE

    Y'know, this might be a non-issue.
    I uninstalled and re-installed the metatag module with the default configuration, and everything is working a-okay now.

    Not totally sure what happened in my installation, but glad that it seems to be working now!

    Gonna go ahead and close this.

Production build 0.71.5 2024