@payloadcms/plugin-redirects 3.64.0-internal.fc1e451 → 3.64.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +158 -1
- package/dist/exports/types.d.ts +1 -0
- package/dist/exports/types.d.ts.map +1 -1
- package/dist/exports/types.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +25 -7
- package/dist/index.js.map +1 -1
- package/dist/translations/index.d.ts +9 -0
- package/dist/translations/index.d.ts.map +1 -0
- package/dist/translations/index.js +10 -0
- package/dist/translations/index.js.map +1 -0
- package/dist/translations/languages/en.d.ts +3 -0
- package/dist/translations/languages/en.d.ts.map +1 -0
- package/dist/translations/languages/en.js +13 -0
- package/dist/translations/languages/en.js.map +1 -0
- package/dist/translations/languages/es.d.ts +3 -0
- package/dist/translations/languages/es.d.ts.map +1 -0
- package/dist/translations/languages/es.js +13 -0
- package/dist/translations/languages/es.js.map +1 -0
- package/dist/translations/languages/fr.d.ts +3 -0
- package/dist/translations/languages/fr.d.ts.map +1 -0
- package/dist/translations/languages/fr.js +13 -0
- package/dist/translations/languages/fr.js.map +1 -0
- package/dist/translations/translation-schema.json +43 -0
- package/dist/translations/types.d.ts +3 -0
- package/dist/translations/types.d.ts.map +1 -0
- package/dist/translations/types.js +3 -0
- package/dist/translations/types.js.map +1 -0
- package/package.json +7 -4
package/README.md
CHANGED
|
@@ -2,6 +2,163 @@
|
|
|
2
2
|
|
|
3
3
|
A plugin for [Payload](https://github.com/payloadcms/payload) to easily manage your redirects from within your admin panel.
|
|
4
4
|
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Manage redirects directly from your admin panel
|
|
8
|
+
- Support for internal (reference) and external (custom URL) redirects
|
|
9
|
+
- Built-in multi-language support
|
|
10
|
+
- Optional redirect types (301, 302, etc.)
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
pnpm add @payloadcms/plugin-redirects
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Basic Usage
|
|
19
|
+
|
|
20
|
+
In your [Payload Config](https://payloadcms.com/docs/configuration/overview), add the plugin:
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
import { buildConfig } from 'payload'
|
|
24
|
+
import { redirectsPlugin } from '@payloadcms/plugin-redirects'
|
|
25
|
+
|
|
26
|
+
export default buildConfig({
|
|
27
|
+
plugins: [
|
|
28
|
+
redirectsPlugin({
|
|
29
|
+
collections: ['pages'], // Collections to use in the 'to' relationship field
|
|
30
|
+
}),
|
|
31
|
+
],
|
|
32
|
+
})
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Configuration
|
|
36
|
+
|
|
37
|
+
### Options
|
|
38
|
+
|
|
39
|
+
| Option | Type | Description |
|
|
40
|
+
| --------------------------- | ---------- | ------------------------------------------------------------------------------------------------------- |
|
|
41
|
+
| `collections` | `string[]` | An array of collection slugs to populate in the `to` field of each redirect. |
|
|
42
|
+
| `overrides` | `object` | A partial collection config that allows you to override anything on the `redirects` collection. |
|
|
43
|
+
| `redirectTypes` | `string[]` | Provide an array of redirects if you want to provide options for the type of redirects to be supported. |
|
|
44
|
+
| `redirectTypeFieldOverride` | `Field` | A partial Field config that allows you to override the Redirect Type field if enabled above. |
|
|
45
|
+
|
|
46
|
+
### Advanced Example
|
|
47
|
+
|
|
48
|
+
```ts
|
|
49
|
+
import { buildConfig } from 'payload'
|
|
50
|
+
import { redirectsPlugin } from '@payloadcms/plugin-redirects'
|
|
51
|
+
|
|
52
|
+
export default buildConfig({
|
|
53
|
+
plugins: [
|
|
54
|
+
redirectsPlugin({
|
|
55
|
+
collections: ['pages', 'posts'],
|
|
56
|
+
|
|
57
|
+
// Add custom redirect types
|
|
58
|
+
redirectTypes: ['301', '302'],
|
|
59
|
+
|
|
60
|
+
// Override the redirects collection
|
|
61
|
+
overrides: {
|
|
62
|
+
slug: 'custom-redirects',
|
|
63
|
+
|
|
64
|
+
// Add custom fields
|
|
65
|
+
fields: ({ defaultFields }) => {
|
|
66
|
+
return [
|
|
67
|
+
...defaultFields,
|
|
68
|
+
{
|
|
69
|
+
name: 'notes',
|
|
70
|
+
type: 'textarea',
|
|
71
|
+
admin: {
|
|
72
|
+
description: 'Internal notes about this redirect',
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
]
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
}),
|
|
79
|
+
],
|
|
80
|
+
})
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Custom Translations
|
|
84
|
+
|
|
85
|
+
The plugin automatically includes translations for English, French, and Spanish. If you want to customize existing translations or add new languages, you can override them in your config:
|
|
86
|
+
|
|
87
|
+
```ts
|
|
88
|
+
import { buildConfig } from 'payload'
|
|
89
|
+
import { redirectsPlugin } from '@payloadcms/plugin-redirects'
|
|
90
|
+
|
|
91
|
+
export default buildConfig({
|
|
92
|
+
i18n: {
|
|
93
|
+
translations: {
|
|
94
|
+
// Add your custom language
|
|
95
|
+
de: {
|
|
96
|
+
'plugin-redirects': {
|
|
97
|
+
fromUrl: 'Von URL',
|
|
98
|
+
toUrlType: 'Ziel-URL-Typ',
|
|
99
|
+
internalLink: 'Interner Link',
|
|
100
|
+
customUrl: 'Benutzerdefinierte URL',
|
|
101
|
+
documentToRedirect: 'Dokument zum Weiterleiten',
|
|
102
|
+
redirectType: 'Weiterleitungstyp',
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
// Or override existing translations
|
|
106
|
+
fr: {
|
|
107
|
+
'plugin-redirects': {
|
|
108
|
+
fromUrl: 'URL source', // Custom override
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
|
|
114
|
+
plugins: [
|
|
115
|
+
redirectsPlugin({
|
|
116
|
+
collections: ['pages'],
|
|
117
|
+
}),
|
|
118
|
+
],
|
|
119
|
+
})
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Using Redirects in Your Frontend
|
|
123
|
+
|
|
124
|
+
The plugin creates a `redirects` collection in your database. You can query this collection from your frontend and implement the redirects using your framework's routing system.
|
|
125
|
+
|
|
126
|
+
### Example: Next.js Middleware
|
|
127
|
+
|
|
128
|
+
```ts
|
|
129
|
+
// middleware.ts
|
|
130
|
+
import { NextResponse } from 'next/server'
|
|
131
|
+
import type { NextRequest } from 'next/server'
|
|
132
|
+
|
|
133
|
+
export async function middleware(request: NextRequest) {
|
|
134
|
+
const { pathname } = request.nextUrl
|
|
135
|
+
|
|
136
|
+
// Fetch redirects from Payload API
|
|
137
|
+
const redirects = await fetch('http://localhost:3000/api/redirects', {
|
|
138
|
+
next: { revalidate: 60 }, // Cache for 60 seconds
|
|
139
|
+
}).then((res) => res.json())
|
|
140
|
+
|
|
141
|
+
// Find matching redirect
|
|
142
|
+
const redirect = redirects.docs?.find((r: any) => r.from === pathname)
|
|
143
|
+
|
|
144
|
+
if (redirect) {
|
|
145
|
+
const destination =
|
|
146
|
+
redirect.to.type === 'reference'
|
|
147
|
+
? redirect.to.reference.slug // Adjust based on your collection structure
|
|
148
|
+
: redirect.to.url
|
|
149
|
+
|
|
150
|
+
return NextResponse.redirect(
|
|
151
|
+
new URL(destination, request.url),
|
|
152
|
+
redirect.type === '301' ? 301 : 302,
|
|
153
|
+
)
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
return NextResponse.next()
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Links
|
|
161
|
+
|
|
5
162
|
- [Source code](https://github.com/payloadcms/payload/tree/main/packages/plugin-redirects)
|
|
6
163
|
- [Documentation](https://payloadcms.com/docs/plugins/redirects)
|
|
7
|
-
- [
|
|
164
|
+
- [Issue tracker](https://github.com/payloadcms/payload/issues)
|
package/dist/exports/types.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/exports/types.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/exports/types.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAA;AAC/F,YAAY,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/exports/types.ts"],"sourcesContent":["export type { RedirectsPluginConfig } from '../types.js'\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/exports/types.ts"],"sourcesContent":["export type { RedirectsTranslationKeys, RedirectsTranslations } from '../translations/index.js'\nexport type { RedirectsPluginConfig } from '../types.js'\n"],"names":[],"mappings":"AACA,WAAwD"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Config } from 'payload';
|
|
2
2
|
import type { RedirectsPluginConfig } from './types.js';
|
|
3
3
|
export { redirectOptions, redirectTypes } from './redirectTypes.js';
|
|
4
|
+
export { translations as redirectsTranslations } from './translations/index.js';
|
|
4
5
|
export declare const redirectsPlugin: (pluginConfig: RedirectsPluginConfig) => (incomingConfig: Config) => Config;
|
|
5
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAoB,MAAM,EAAsB,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAoB,MAAM,EAAsB,MAAM,SAAS,CAAA;AAI3E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;AAKvD,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AACnE,OAAO,EAAE,YAAY,IAAI,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAC/E,eAAO,MAAM,eAAe,iBACX,qBAAqB,sBACnB,MAAM,KAAG,MAiHzB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,22 @@
|
|
|
1
|
+
import { deepMergeSimple } from 'payload/shared';
|
|
1
2
|
import { redirectOptions } from './redirectTypes.js';
|
|
3
|
+
import { translations } from './translations/index.js';
|
|
2
4
|
export { redirectOptions, redirectTypes } from './redirectTypes.js';
|
|
5
|
+
export { translations as redirectsTranslations } from './translations/index.js';
|
|
3
6
|
export const redirectsPlugin = (pluginConfig)=>(incomingConfig)=>{
|
|
7
|
+
// Merge translations FIRST (before building fields)
|
|
8
|
+
if (!incomingConfig.i18n) {
|
|
9
|
+
incomingConfig.i18n = {};
|
|
10
|
+
}
|
|
11
|
+
if (!incomingConfig.i18n?.translations) {
|
|
12
|
+
incomingConfig.i18n.translations = {};
|
|
13
|
+
}
|
|
14
|
+
incomingConfig.i18n.translations = deepMergeSimple(translations, incomingConfig.i18n?.translations);
|
|
4
15
|
const redirectSelectField = {
|
|
5
16
|
name: 'type',
|
|
6
17
|
type: 'select',
|
|
7
|
-
|
|
18
|
+
// @ts-expect-error - translations are not typed in plugins yet
|
|
19
|
+
label: ({ t })=>t('plugin-redirects:redirectType'),
|
|
8
20
|
options: redirectOptions.filter((option)=>pluginConfig?.redirectTypes?.includes(option.value)),
|
|
9
21
|
required: true,
|
|
10
22
|
...pluginConfig?.redirectTypeFieldOverride || {}
|
|
@@ -14,7 +26,8 @@ export const redirectsPlugin = (pluginConfig)=>(incomingConfig)=>{
|
|
|
14
26
|
name: 'from',
|
|
15
27
|
type: 'text',
|
|
16
28
|
index: true,
|
|
17
|
-
|
|
29
|
+
// @ts-expect-error - translations are not typed in plugins yet
|
|
30
|
+
label: ({ t })=>t('plugin-redirects:fromUrl'),
|
|
18
31
|
required: true,
|
|
19
32
|
unique: true
|
|
20
33
|
},
|
|
@@ -29,14 +42,17 @@ export const redirectsPlugin = (pluginConfig)=>(incomingConfig)=>{
|
|
|
29
42
|
layout: 'horizontal'
|
|
30
43
|
},
|
|
31
44
|
defaultValue: 'reference',
|
|
32
|
-
|
|
45
|
+
// @ts-expect-error - translations are not typed in plugins yet
|
|
46
|
+
label: ({ t })=>t('plugin-redirects:toUrlType'),
|
|
33
47
|
options: [
|
|
34
48
|
{
|
|
35
|
-
|
|
49
|
+
// @ts-expect-error - translations are not typed in plugins yet
|
|
50
|
+
label: ({ t })=>t('plugin-redirects:internalLink'),
|
|
36
51
|
value: 'reference'
|
|
37
52
|
},
|
|
38
53
|
{
|
|
39
|
-
|
|
54
|
+
// @ts-expect-error - translations are not typed in plugins yet
|
|
55
|
+
label: ({ t })=>t('plugin-redirects:customUrl'),
|
|
40
56
|
value: 'custom'
|
|
41
57
|
}
|
|
42
58
|
]
|
|
@@ -47,7 +63,8 @@ export const redirectsPlugin = (pluginConfig)=>(incomingConfig)=>{
|
|
|
47
63
|
admin: {
|
|
48
64
|
condition: (_, siblingData)=>siblingData?.type === 'reference'
|
|
49
65
|
},
|
|
50
|
-
|
|
66
|
+
// @ts-expect-error - translations are not typed in plugins yet
|
|
67
|
+
label: ({ t })=>t('plugin-redirects:documentToRedirect'),
|
|
51
68
|
relationTo: pluginConfig?.collections || [],
|
|
52
69
|
required: true
|
|
53
70
|
},
|
|
@@ -57,7 +74,8 @@ export const redirectsPlugin = (pluginConfig)=>(incomingConfig)=>{
|
|
|
57
74
|
admin: {
|
|
58
75
|
condition: (_, siblingData)=>siblingData?.type === 'custom'
|
|
59
76
|
},
|
|
60
|
-
|
|
77
|
+
// @ts-expect-error - translations are not typed in plugins yet
|
|
78
|
+
label: ({ t })=>t('plugin-redirects:customUrl'),
|
|
61
79
|
required: true
|
|
62
80
|
}
|
|
63
81
|
],
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { CollectionConfig, Config, Field, SelectField } from 'payload'\n\nimport type { RedirectsPluginConfig } from './types.js'\n\nimport { redirectOptions } from './redirectTypes.js'\n\nexport { redirectOptions, redirectTypes } from './redirectTypes.js'\nexport const redirectsPlugin =\n (pluginConfig: RedirectsPluginConfig) =>\n (incomingConfig: Config): Config => {\n const redirectSelectField: SelectField = {\n name: 'type',\n type: 'select',\n label:
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { CollectionConfig, Config, Field, SelectField } from 'payload'\n\nimport { deepMergeSimple } from 'payload/shared'\n\nimport type { RedirectsPluginConfig } from './types.js'\n\nimport { redirectOptions } from './redirectTypes.js'\nimport { translations } from './translations/index.js'\n\nexport { redirectOptions, redirectTypes } from './redirectTypes.js'\nexport { translations as redirectsTranslations } from './translations/index.js'\nexport const redirectsPlugin =\n (pluginConfig: RedirectsPluginConfig) =>\n (incomingConfig: Config): Config => {\n // Merge translations FIRST (before building fields)\n if (!incomingConfig.i18n) {\n incomingConfig.i18n = {}\n }\n\n if (!incomingConfig.i18n?.translations) {\n incomingConfig.i18n.translations = {}\n }\n\n incomingConfig.i18n.translations = deepMergeSimple(\n translations,\n incomingConfig.i18n?.translations,\n )\n\n const redirectSelectField: SelectField = {\n name: 'type',\n type: 'select',\n // @ts-expect-error - translations are not typed in plugins yet\n label: ({ t }) => t('plugin-redirects:redirectType'),\n options: redirectOptions.filter((option) =>\n pluginConfig?.redirectTypes?.includes(option.value),\n ),\n required: true,\n ...((pluginConfig?.redirectTypeFieldOverride || {}) as {\n hasMany: boolean\n } & Partial<SelectField>),\n }\n\n const defaultFields: Field[] = [\n {\n name: 'from',\n type: 'text',\n index: true,\n // @ts-expect-error - translations are not typed in plugins yet\n label: ({ t }) => t('plugin-redirects:fromUrl'),\n required: true,\n unique: true,\n },\n {\n name: 'to',\n type: 'group',\n fields: [\n {\n name: 'type',\n type: 'radio',\n admin: {\n layout: 'horizontal',\n },\n defaultValue: 'reference',\n // @ts-expect-error - translations are not typed in plugins yet\n label: ({ t }) => t('plugin-redirects:toUrlType'),\n options: [\n {\n // @ts-expect-error - translations are not typed in plugins yet\n label: ({ t }) => t('plugin-redirects:internalLink'),\n value: 'reference',\n },\n {\n // @ts-expect-error - translations are not typed in plugins yet\n label: ({ t }) => t('plugin-redirects:customUrl'),\n value: 'custom',\n },\n ],\n },\n {\n name: 'reference',\n type: 'relationship',\n admin: {\n condition: (_, siblingData) => siblingData?.type === 'reference',\n },\n // @ts-expect-error - translations are not typed in plugins yet\n label: ({ t }) => t('plugin-redirects:documentToRedirect'),\n relationTo: pluginConfig?.collections || [],\n required: true,\n },\n {\n name: 'url',\n type: 'text',\n admin: {\n condition: (_, siblingData) => siblingData?.type === 'custom',\n },\n // @ts-expect-error - translations are not typed in plugins yet\n label: ({ t }) => t('plugin-redirects:customUrl'),\n required: true,\n },\n ],\n label: false,\n },\n ...(pluginConfig?.redirectTypes ? [redirectSelectField] : []),\n ]\n\n const redirectsCollection: CollectionConfig = {\n ...(pluginConfig?.overrides || {}),\n slug: pluginConfig?.overrides?.slug || 'redirects',\n access: {\n read: () => true,\n ...(pluginConfig?.overrides?.access || {}),\n },\n admin: {\n defaultColumns: ['from', 'to.type', 'createdAt'],\n ...(pluginConfig?.overrides?.admin || {}),\n },\n fields:\n pluginConfig?.overrides?.fields && typeof pluginConfig?.overrides?.fields === 'function'\n ? pluginConfig?.overrides.fields({ defaultFields })\n : defaultFields,\n }\n\n return {\n ...incomingConfig,\n collections: [...(incomingConfig?.collections || []), redirectsCollection],\n }\n }\n"],"names":["deepMergeSimple","redirectOptions","translations","redirectTypes","redirectsTranslations","redirectsPlugin","pluginConfig","incomingConfig","i18n","redirectSelectField","name","type","label","t","options","filter","option","includes","value","required","redirectTypeFieldOverride","defaultFields","index","unique","fields","admin","layout","defaultValue","condition","_","siblingData","relationTo","collections","redirectsCollection","overrides","slug","access","read","def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payloadcms/translations';
|
|
2
|
+
export declare const translations: {
|
|
3
|
+
en: GenericTranslationsObject;
|
|
4
|
+
es: GenericTranslationsObject;
|
|
5
|
+
fr: GenericTranslationsObject;
|
|
6
|
+
};
|
|
7
|
+
export type RedirectsTranslations = GenericTranslationsObject;
|
|
8
|
+
export type RedirectsTranslationKeys = NestedKeysStripped<RedirectsTranslations>;
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/translations/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAM7F,eAAO,MAAM,YAAY;;;;CAIxB,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG,yBAAyB,CAAA;AAE7D,MAAM,MAAM,wBAAwB,GAAG,kBAAkB,CAAC,qBAAqB,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/translations/index.ts"],"sourcesContent":["import type { GenericTranslationsObject, NestedKeysStripped } from '@payloadcms/translations'\n\nimport { en } from './languages/en.js'\nimport { es } from './languages/es.js'\nimport { fr } from './languages/fr.js'\n\nexport const translations = {\n en,\n es,\n fr,\n}\n\nexport type RedirectsTranslations = GenericTranslationsObject\n\nexport type RedirectsTranslationKeys = NestedKeysStripped<RedirectsTranslations>\n"],"names":["en","es","fr","translations"],"mappings":"AAEA,SAASA,EAAE,QAAQ,oBAAmB;AACtC,SAASC,EAAE,QAAQ,oBAAmB;AACtC,SAASC,EAAE,QAAQ,oBAAmB;AAEtC,OAAO,MAAMC,eAAe;IAC1BH;IACAC;IACAC;AACF,EAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../../src/translations/languages/en.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAA;AAEzE,eAAO,MAAM,EAAE,EAAE,yBAUhB,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const en = {
|
|
2
|
+
$schema: '../translation-schema.json',
|
|
3
|
+
'plugin-redirects': {
|
|
4
|
+
customUrl: 'Custom URL',
|
|
5
|
+
documentToRedirect: 'Document to redirect to',
|
|
6
|
+
fromUrl: 'From URL',
|
|
7
|
+
internalLink: 'Internal link',
|
|
8
|
+
redirectType: 'Redirect Type',
|
|
9
|
+
toUrlType: 'To URL Type'
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=en.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/translations/languages/en.ts"],"sourcesContent":["import type { GenericTranslationsObject } from '@payloadcms/translations'\n\nexport const en: GenericTranslationsObject = {\n $schema: '../translation-schema.json',\n 'plugin-redirects': {\n customUrl: 'Custom URL',\n documentToRedirect: 'Document to redirect to',\n fromUrl: 'From URL',\n internalLink: 'Internal link',\n redirectType: 'Redirect Type',\n toUrlType: 'To URL Type',\n },\n}\n"],"names":["en","$schema","customUrl","documentToRedirect","fromUrl","internalLink","redirectType","toUrlType"],"mappings":"AAEA,OAAO,MAAMA,KAAgC;IAC3CC,SAAS;IACT,oBAAoB;QAClBC,WAAW;QACXC,oBAAoB;QACpBC,SAAS;QACTC,cAAc;QACdC,cAAc;QACdC,WAAW;IACb;AACF,EAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"es.d.ts","sourceRoot":"","sources":["../../../src/translations/languages/es.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAA;AAEzE,eAAO,MAAM,EAAE,EAAE,yBAUhB,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const es = {
|
|
2
|
+
$schema: '../translation-schema.json',
|
|
3
|
+
'plugin-redirects': {
|
|
4
|
+
customUrl: 'URL personalizada',
|
|
5
|
+
documentToRedirect: 'Documento al que redirigir',
|
|
6
|
+
fromUrl: 'URL de origen',
|
|
7
|
+
internalLink: 'Enlace interno',
|
|
8
|
+
redirectType: 'Tipo de redirección',
|
|
9
|
+
toUrlType: 'Tipo de URL de destino'
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/translations/languages/es.ts"],"sourcesContent":["import type { GenericTranslationsObject } from '@payloadcms/translations'\n\nexport const es: GenericTranslationsObject = {\n $schema: '../translation-schema.json',\n 'plugin-redirects': {\n customUrl: 'URL personalizada',\n documentToRedirect: 'Documento al que redirigir',\n fromUrl: 'URL de origen',\n internalLink: 'Enlace interno',\n redirectType: 'Tipo de redirección',\n toUrlType: 'Tipo de URL de destino',\n },\n}\n"],"names":["es","$schema","customUrl","documentToRedirect","fromUrl","internalLink","redirectType","toUrlType"],"mappings":"AAEA,OAAO,MAAMA,KAAgC;IAC3CC,SAAS;IACT,oBAAoB;QAClBC,WAAW;QACXC,oBAAoB;QACpBC,SAAS;QACTC,cAAc;QACdC,cAAc;QACdC,WAAW;IACb;AACF,EAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fr.d.ts","sourceRoot":"","sources":["../../../src/translations/languages/fr.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAA;AAEzE,eAAO,MAAM,EAAE,EAAE,yBAUhB,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const fr = {
|
|
2
|
+
$schema: '../translation-schema.json',
|
|
3
|
+
'plugin-redirects': {
|
|
4
|
+
customUrl: 'URL personnalisée',
|
|
5
|
+
documentToRedirect: 'Page de redirection',
|
|
6
|
+
fromUrl: "URL d'origine",
|
|
7
|
+
internalLink: 'Référence vers une page',
|
|
8
|
+
redirectType: 'Type de redirection',
|
|
9
|
+
toUrlType: "Type d'URL de destination"
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=fr.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/translations/languages/fr.ts"],"sourcesContent":["import type { GenericTranslationsObject } from '@payloadcms/translations'\n\nexport const fr: GenericTranslationsObject = {\n $schema: '../translation-schema.json',\n 'plugin-redirects': {\n customUrl: 'URL personnalisée',\n documentToRedirect: 'Page de redirection',\n fromUrl: \"URL d'origine\",\n internalLink: 'Référence vers une page',\n redirectType: 'Type de redirection',\n toUrlType: \"Type d'URL de destination\",\n },\n}\n"],"names":["fr","$schema","customUrl","documentToRedirect","fromUrl","internalLink","redirectType","toUrlType"],"mappings":"AAEA,OAAO,MAAMA,KAAgC;IAC3CC,SAAS;IACT,oBAAoB;QAClBC,WAAW;QACXC,oBAAoB;QACpBC,SAAS;QACTC,cAAc;QACdC,cAAc;QACdC,WAAW;IACb;AACF,EAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "object",
|
|
3
|
+
"$schema": "http://json-schema.org/draft-04/schema#",
|
|
4
|
+
"additionalProperties": false,
|
|
5
|
+
"properties": {
|
|
6
|
+
"$schema": {
|
|
7
|
+
"type": "string"
|
|
8
|
+
},
|
|
9
|
+
"plugin-redirects": {
|
|
10
|
+
"type": "object",
|
|
11
|
+
"additionalProperties": false,
|
|
12
|
+
"properties": {
|
|
13
|
+
"fromUrl": {
|
|
14
|
+
"type": "string"
|
|
15
|
+
},
|
|
16
|
+
"toUrlType": {
|
|
17
|
+
"type": "string"
|
|
18
|
+
},
|
|
19
|
+
"internalLink": {
|
|
20
|
+
"type": "string"
|
|
21
|
+
},
|
|
22
|
+
"customUrl": {
|
|
23
|
+
"type": "string"
|
|
24
|
+
},
|
|
25
|
+
"documentToRedirect": {
|
|
26
|
+
"type": "string"
|
|
27
|
+
},
|
|
28
|
+
"redirectType": {
|
|
29
|
+
"type": "string"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"required": [
|
|
33
|
+
"fromUrl",
|
|
34
|
+
"toUrlType",
|
|
35
|
+
"internalLink",
|
|
36
|
+
"customUrl",
|
|
37
|
+
"documentToRedirect",
|
|
38
|
+
"redirectType"
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"required": ["plugin-redirects"]
|
|
43
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/translations/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,mBAAmB,CAAA;AAE3C,MAAM,MAAM,+BAA+B,GAAG,OAAO,EAAE,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/translations/types.ts"],"sourcesContent":["import type { en } from './languages/en.js'\n\nexport type PluginDefaultTranslationsObject = typeof en\n"],"names":[],"mappings":"AAEA,WAAuD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/plugin-redirects",
|
|
3
|
-
"version": "3.64.0
|
|
3
|
+
"version": "3.64.0",
|
|
4
4
|
"description": "Redirects plugin for Payload",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"payload",
|
|
@@ -46,12 +46,15 @@
|
|
|
46
46
|
"types.js",
|
|
47
47
|
"types.d.ts"
|
|
48
48
|
],
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"payload": "3.64.0",
|
|
51
|
+
"@payloadcms/translations": "3.64.0"
|
|
52
|
+
},
|
|
49
53
|
"devDependencies": {
|
|
50
|
-
"@payloadcms/eslint-config": "3.28.0"
|
|
51
|
-
"payload": "3.64.0-internal.fc1e451"
|
|
54
|
+
"@payloadcms/eslint-config": "3.28.0"
|
|
52
55
|
},
|
|
53
56
|
"peerDependencies": {
|
|
54
|
-
"payload": "3.64.0
|
|
57
|
+
"payload": "3.64.0"
|
|
55
58
|
},
|
|
56
59
|
"homepage:": "https://payloadcms.com",
|
|
57
60
|
"scripts": {
|