Skip to content

Allow empty schema.org values #548

Closed

Description

@Buzut

Describe the feature

Currently some values have defaults (product SKU, priceValidUntil…). This is handled through setIfEmpty function.

We should allow to opt out from default values if for whatever reason we want to discard a property. So instead of just checking for falseness, we might check for undefined and let users override this.

In that case, remove the property from the output if set to null.

{
  ...
  sku: null, // explicitly left out
}

Additional information

  • Would you be willing to help implement this feature?

Activity

  1. added
    enhancement
    on May 4, 2025
  2. IsraelOrtuno commented on Jul 11, 2025

    @IsraelOrtuno

    I support this feature. I am trying to get rid of the url property for an organization in a job posting and there's no way. The url property has a fallback to the default url (I assume the one configured with NuxtSeo in my case) whenever the value is empty. I like being able to discard the property if null but also not sure if that could impact other properties.

    I suspect is due to this but still unsure how the package works:

    https://github.com/unjs/unhead/blob/main/packages/schema-org/src/nodes/Organization/index.ts#L102

  3. added a commit that references this issue on Mar 10, 2026
    4f5a7c1
  4. added a commit that references this issue on Apr 5, 2026
    01a7aaf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions