@webx-ui/module-seo 0.1.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/LICENSE +21 -0
- package/README.md +58 -0
- package/dist/SeoCard.d.ts +38 -0
- package/dist/SeoLayout.d.ts +33 -0
- package/dist/SeoRedirectDialog.d.ts +9 -0
- package/dist/SeoRedirectsPage.d.ts +13 -0
- package/dist/SeoUrlDialog.d.ts +19 -0
- package/dist/SeoUrlsPage.d.ts +17 -0
- package/dist/TestUrlDialog.d.ts +2 -0
- package/dist/api.d.ts +18 -0
- package/dist/i18n.d.ts +2 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +1446 -0
- package/dist/index.js.map +1 -0
- package/dist/messages.d.ts +13 -0
- package/dist/module.d.ts +21 -0
- package/dist/rule.d.ts +17 -0
- package/dist/style.css +1 -0
- package/dist/types.d.ts +132 -0
- package/package.json +65 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 webx-ui
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# @webx-ui/module-seo
|
|
2
|
+
|
|
3
|
+
SEO as a section of the [WebX UI](https://github.com/webx-ui/webx-ui) admin panel: the rules
|
|
4
|
+
written for addresses, the addresses that have moved, and the card that edits what a page says
|
|
5
|
+
about itself.
|
|
6
|
+
|
|
7
|
+
The other half is `webx-ui/module-seo` on the server, which is what actually prints a `<head>`.
|
|
8
|
+
Neither is useful alone.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
pnpm add @webx-ui/module-seo
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
import { createAdmin } from '@webx-ui/module-admin'
|
|
18
|
+
import { WxMediaField } from '@webx-ui/module-media'
|
|
19
|
+
import { seo } from '@webx-ui/module-seo'
|
|
20
|
+
import '@webx-ui/module-seo/style.css'
|
|
21
|
+
|
|
22
|
+
createAdmin({
|
|
23
|
+
modules: [seo({ mediaField: WxMediaField })],
|
|
24
|
+
})
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
The section appears under **System** once the Composer half is installed and migrated.
|
|
28
|
+
Permissions: `seo.view`, `seo.manage`.
|
|
29
|
+
|
|
30
|
+
`mediaField` is handed in rather than imported, so this package does not depend on the media
|
|
31
|
+
library being installed — without it every other SEO field still works and only the share image
|
|
32
|
+
is missing.
|
|
33
|
+
|
|
34
|
+
## What it brings
|
|
35
|
+
|
|
36
|
+
- `/seo` — the rules, listed in the order the site tries them.
|
|
37
|
+
- `/seo/redirects` — the addresses that have moved, busiest first.
|
|
38
|
+
- **Check an address** — which redirect catches it, which rule matched, what every source
|
|
39
|
+
contributed, and what the page ends up saying. One call instead of a reading of the code.
|
|
40
|
+
- `wx-seo` — a field type any screen can use, whose value is everything a page says about itself
|
|
41
|
+
as one object. `WxSeo` is exported directly for a form that would rather place it by hand.
|
|
42
|
+
|
|
43
|
+
## Talking to it directly
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
import { createSeoApi } from '@webx-ui/module-seo'
|
|
47
|
+
|
|
48
|
+
const api = createSeoApi(useAdmin())
|
|
49
|
+
|
|
50
|
+
await api.urls({ q: '/catalog' })
|
|
51
|
+
await api.test('/catalog/shoes?page=2')
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
The guide is at [webx-ui.github.io/webx-ui/guide/seo](https://webx-ui.github.io/webx-ui/guide/seo.html).
|
|
55
|
+
|
|
56
|
+
## License
|
|
57
|
+
|
|
58
|
+
MIT.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Component } from 'vue';
|
|
2
|
+
import { SeoValue } from './types';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
/**
|
|
5
|
+
* The field that picks the share image — `WxMediaField` in a panel that has the library.
|
|
6
|
+
*
|
|
7
|
+
* Handed in rather than imported: this package does not depend on the media one, and a panel
|
|
8
|
+
* without a library still edits everything else about a page.
|
|
9
|
+
*/
|
|
10
|
+
mediaField?: Component;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Soft limits, for the counters only. Long is not wrong — search engines shorten what they
|
|
14
|
+
* shorten — so nothing here refuses a longer line, it only says how long it is.
|
|
15
|
+
*/
|
|
16
|
+
titleLimit?: number;
|
|
17
|
+
descriptionLimit?: number;
|
|
18
|
+
/** What the snippet preview shows above the title. */
|
|
19
|
+
site?: string;
|
|
20
|
+
/** Hidden when a screen has no use for them. */
|
|
21
|
+
structuredData?: boolean;
|
|
22
|
+
};
|
|
23
|
+
type __VLS_PublicProps = {
|
|
24
|
+
modelValue?: SeoValue | null;
|
|
25
|
+
} & __VLS_Props;
|
|
26
|
+
declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
27
|
+
"update:modelValue": (value: Partial<import('./types').SeoFields> | null) => any;
|
|
28
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
29
|
+
"onUpdate:modelValue"?: ((value: Partial<import('./types').SeoFields> | null) => any) | undefined;
|
|
30
|
+
}>, {
|
|
31
|
+
mediaField: Component;
|
|
32
|
+
disabled: boolean;
|
|
33
|
+
titleLimit: number;
|
|
34
|
+
descriptionLimit: number;
|
|
35
|
+
site: string;
|
|
36
|
+
structuredData: boolean;
|
|
37
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
38
|
+
export default _default;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The head of the section: its name, the switch between what it holds, and the one tool that
|
|
3
|
+
* belongs to the whole of it.
|
|
4
|
+
*
|
|
5
|
+
* Rules and redirects are two screens rather than two tabs of one, because they are two tables
|
|
6
|
+
* with their own paging and their own search — and a tab that quietly resets both when you come
|
|
7
|
+
* back to it is worse than a second address.
|
|
8
|
+
*/
|
|
9
|
+
type __VLS_Props = {
|
|
10
|
+
base: string;
|
|
11
|
+
current: 'rules' | 'redirects';
|
|
12
|
+
};
|
|
13
|
+
declare function __VLS_template(): {
|
|
14
|
+
attrs: Partial<{}>;
|
|
15
|
+
slots: {
|
|
16
|
+
default?(_: {}): any;
|
|
17
|
+
};
|
|
18
|
+
refs: {};
|
|
19
|
+
rootEl: HTMLDivElement;
|
|
20
|
+
};
|
|
21
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
22
|
+
declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
23
|
+
test: () => any;
|
|
24
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
25
|
+
onTest?: (() => any) | undefined;
|
|
26
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
27
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
28
|
+
export default _default;
|
|
29
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
30
|
+
new (): {
|
|
31
|
+
$slots: S;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { SeoRedirect } from './types';
|
|
2
|
+
/** One address that has moved, and where to. Four fields, so four fields. */
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
redirect?: SeoRedirect | null;
|
|
5
|
+
};
|
|
6
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
7
|
+
redirect: SeoRedirect | null;
|
|
8
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The addresses that have moved.
|
|
3
|
+
*
|
|
4
|
+
* Busiest first by default, which is the order this list is worked on: a redirect nobody has
|
|
5
|
+
* followed since the site was rebuilt is the one worth deleting, and it sits at the bottom.
|
|
6
|
+
*/
|
|
7
|
+
type __VLS_Props = {
|
|
8
|
+
base?: string;
|
|
9
|
+
};
|
|
10
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
11
|
+
base: string;
|
|
12
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
13
|
+
export default _default;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Component } from 'vue';
|
|
2
|
+
import { SeoUrlRule } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* One rule: which addresses it covers, and what it says about them.
|
|
5
|
+
*
|
|
6
|
+
* A dialog rather than a second route, and a template rather than a described screen — the same
|
|
7
|
+
* decision `admins.form` is on, until the screens mechanism has been round the block a few more
|
|
8
|
+
* times. What it edits below the address is `WxSeo`, the same card a content module will get by
|
|
9
|
+
* patching it into its own form.
|
|
10
|
+
*/
|
|
11
|
+
type __VLS_Props = {
|
|
12
|
+
rule?: SeoUrlRule | null;
|
|
13
|
+
mediaField?: Component;
|
|
14
|
+
};
|
|
15
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
16
|
+
rule: SeoUrlRule | null;
|
|
17
|
+
mediaField: Component;
|
|
18
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
19
|
+
export default _default;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Component } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* The rules written for addresses.
|
|
4
|
+
*
|
|
5
|
+
* Listed in the order the site tries them — exact, then mask, then regular expression, by
|
|
6
|
+
* priority inside each group — so that reading the table top to bottom is reading what will
|
|
7
|
+
* happen. Sorting it any other way would hide the one thing a person comes here to work out.
|
|
8
|
+
*/
|
|
9
|
+
type __VLS_Props = {
|
|
10
|
+
base?: string;
|
|
11
|
+
mediaField?: Component;
|
|
12
|
+
};
|
|
13
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
14
|
+
mediaField: Component;
|
|
15
|
+
base: string;
|
|
16
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
17
|
+
export default _default;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
export default _default;
|
package/dist/api.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AdminContext } from '@webx-ui/module-admin';
|
|
2
|
+
import { SeoPage, SeoRedirect, SeoRedirectInput, SeoRedirectQuery, SeoTestResult, SeoUrlInput, SeoUrlQuery, SeoUrlRule } from './types';
|
|
3
|
+
export interface SeoApi {
|
|
4
|
+
/** The rules, in the order the site tries them. */
|
|
5
|
+
urls(query?: SeoUrlQuery): Promise<SeoPage<SeoUrlRule>>;
|
|
6
|
+
url(id: number): Promise<SeoUrlRule>;
|
|
7
|
+
createUrl(input: SeoUrlInput): Promise<SeoUrlRule>;
|
|
8
|
+
updateUrl(id: number, input: SeoUrlInput): Promise<SeoUrlRule>;
|
|
9
|
+
removeUrl(id: number): Promise<void>;
|
|
10
|
+
redirects(query?: SeoRedirectQuery): Promise<SeoPage<SeoRedirect>>;
|
|
11
|
+
createRedirect(input: SeoRedirectInput): Promise<SeoRedirect>;
|
|
12
|
+
updateRedirect(id: number, input: SeoRedirectInput): Promise<SeoRedirect>;
|
|
13
|
+
removeRedirect(id: number): Promise<void>;
|
|
14
|
+
/** What an address ends up saying, and where every part of it came from. */
|
|
15
|
+
test(url: string, locale?: string | null): Promise<SeoTestResult>;
|
|
16
|
+
}
|
|
17
|
+
/** Everything under `/seo`, below the panel's API path. */
|
|
18
|
+
export declare function createSeoApi(admin: AdminContext): SeoApi;
|
package/dist/i18n.d.ts
ADDED
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { seo, type SeoOptions } from './module';
|
|
2
|
+
export { createSeoApi, type SeoApi } from './api';
|
|
3
|
+
export { seoMessages } from './messages';
|
|
4
|
+
export { ruleInput, ruleTitle, seoOf } from './rule';
|
|
5
|
+
export { default as WxSeo } from './SeoCard';
|
|
6
|
+
export { default as WxSeoUrlsPage } from './SeoUrlsPage';
|
|
7
|
+
export { default as WxSeoRedirectsPage } from './SeoRedirectsPage';
|
|
8
|
+
export type { MatchType, RobotsDirective, SeoChainStep, SeoFields, SeoImage, SeoPage, SeoRedirect, SeoRedirectInput, SeoRedirectQuery, SeoResolved, SeoTestResult, SeoUrlInput, SeoUrlQuery, SeoUrlRule, SeoValue, } from './types';
|
|
9
|
+
export { robotsDirectives } from './types';
|