silverwolf-x's picture
download
raw
561 Bytes
import { Field } from "payload/types";
import formatSlug from "../utilities/formatSlug";
import deepMerge from "../utilities/deepMerge";
type Slug = (fieldToUse?: string, overrides?: Partial<Field>) => Field;
export const slugField: Slug = (fieldToUse = "title", overrides) =>
deepMerge<Field, Partial<Field>>(
{
name: "slug",
label: "Slug",
type: "text",
index: true,
admin: {
position: "sidebar",
},
hooks: {
beforeValidate: [formatSlug(fieldToUse)],
},
},
overrides || {},
);

Xet Storage Details

Size:
561 Bytes
·
Xet hash:
7d69bd610256a06288603720908236f00cbfaa851cd1e36ed01a31247d6c539a

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.