Skip to content

Add generated labels to social link transforms #42

Description

@essential-randomness

Add a generated label field to @fujocoded/zod-transform-socials social link output. This can be used as a user-facing label for the link text, list item label, etc.

Why

Without a label field, custom platforms or duplicate accounts on a platform have no central place to be specified or overridden. Cases include: distinguishing a personal social account vs an art social account; or giving a name to a custom site.

Example

Input:

contacts:
  - https://github.com/FujoWebDev
  - url: https://www.fujocoded.com/
    label: Official Website
    icon: lucide:globe
  - url: https://store.fujocoded.com
    label: Merch Store
    icon: lucide:shopping-bag
  - https://fujoweb.dev

Output:

[
  { url: "https://github.com/FujoWebDev", platform: "github", username: "fujowebdev", icon: "simple-icons:github", label: "github" },
  { url: "https://www.fujocoded.com/", platform: "custom", username: null, icon: "lucide:globe", label: "Official Website" },
  { url: "https://store.fujocoded.com", platform: "custom", username: null, icon: "lucide:shopping-bag", label: “Merch Store" },
  { url: "https://fujoweb.dev", platform: "custom", username: null, icon: null, label: “fujoweb.dev" },
]

Todo

  • Add optional label?: string to object social input.
  • Add label: string to transformed social output.
  • Generate labels with this precedence:
    • explicit input label
    • known platform name when platform !== "custom"
    • fallback from url, stripping leading www.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions