FujoWebDev / FujoWebDev/fujocoded-plugins

Add generated labels to social link transforms

Open
#42 0 comments 0 reactions 0 assignees View on GitHub
good first issue zod-transform-socials
Dominant language
TypeScript
Stars
30
Forks
7
PR merge metrics
No merged PRs in 30d

Description

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:

```yaml
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:

```js
[
{ 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.`

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.