svelte-meta-tags 2.7.2 → 3.0.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/dist/JsonLd.svelte +13 -13
- package/dist/JsonLd.svelte.d.ts +18 -4
- package/dist/MetaTags.svelte +43 -49
- package/dist/MetaTags.svelte.d.ts +29 -4
- package/dist/types.d.ts +16 -13
- package/package.json +13 -28
- package/README.md +0 -1102
package/dist/JsonLd.svelte
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
<script>export let output = "head";
|
|
2
|
+
export let schema = void 0;
|
|
3
|
+
$:
|
|
4
|
+
isValid = schema && typeof schema === "object";
|
|
5
|
+
const createSchema = (schema2) => {
|
|
6
|
+
const addContext = (context) => ({
|
|
7
|
+
"@context": "https://schema.org",
|
|
8
|
+
...context
|
|
9
|
+
});
|
|
10
|
+
return Array.isArray(schema2) ? schema2.map((context) => addContext(context)) : addContext(schema2);
|
|
11
|
+
};
|
|
12
|
+
$:
|
|
13
|
+
json = `${'<script type="application/ld+json">'}${JSON.stringify(createSchema(schema))}${"<\/script>"}`;
|
|
14
14
|
</script>
|
|
15
15
|
|
|
16
16
|
<svelte:head>
|
package/dist/JsonLd.svelte.d.ts
CHANGED
|
@@ -1,4 +1,18 @@
|
|
|
1
|
-
import { SvelteComponentTyped } from
|
|
2
|
-
import { JsonLdProps } from './types';
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { JsonLdProps } from './types';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
output?: JsonLdProps['output'];
|
|
6
|
+
schema?: JsonLdProps['schema'];
|
|
7
|
+
};
|
|
8
|
+
events: {
|
|
9
|
+
[evt: string]: CustomEvent<any>;
|
|
10
|
+
};
|
|
11
|
+
slots: {};
|
|
12
|
+
};
|
|
13
|
+
type JsonLdProps_ = typeof __propDef.props;
|
|
14
|
+
export { JsonLdProps_ as JsonLdProps };
|
|
15
|
+
export type JsonLdEvents = typeof __propDef.events;
|
|
16
|
+
export type JsonLdSlots = typeof __propDef.slots;
|
|
17
|
+
export default class JsonLd extends SvelteComponentTyped<JsonLdProps, JsonLdEvents, JsonLdSlots> {
|
|
18
|
+
}
|
package/dist/MetaTags.svelte
CHANGED
|
@@ -1,50 +1,44 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
maxImagePreview ? `,max-image-preview:${maxImagePreview}` : ''
|
|
34
|
-
}${noarchive ? ',noarchive' : ''}${unavailableAfter ? `,unavailable_after:${unavailableAfter}` : ''}${
|
|
35
|
-
noimageindex ? ',noimageindex' : ''
|
|
36
|
-
}${maxVideoPreview ? `,max-video-preview:${maxVideoPreview}` : ''}${notranslate ? ',notranslate' : ''}`;
|
|
1
|
+
<script>export let title = "";
|
|
2
|
+
export let titleTemplate = "";
|
|
3
|
+
export let robots = "index,follow";
|
|
4
|
+
export let additionalRobotsProps = void 0;
|
|
5
|
+
export let description = void 0;
|
|
6
|
+
export let mobileAlternate = void 0;
|
|
7
|
+
export let languageAlternates = void 0;
|
|
8
|
+
export let twitter = void 0;
|
|
9
|
+
export let facebook = void 0;
|
|
10
|
+
export let openGraph = void 0;
|
|
11
|
+
export let canonical = void 0;
|
|
12
|
+
export let additionalMetaTags = void 0;
|
|
13
|
+
export let additionalLinkTags = void 0;
|
|
14
|
+
$:
|
|
15
|
+
updatedTitle = titleTemplate ? title ? titleTemplate.replace(/%s/g, title) : title : title;
|
|
16
|
+
let robotsParams = "";
|
|
17
|
+
if (additionalRobotsProps) {
|
|
18
|
+
const {
|
|
19
|
+
nosnippet,
|
|
20
|
+
maxSnippet,
|
|
21
|
+
maxImagePreview,
|
|
22
|
+
maxVideoPreview,
|
|
23
|
+
noarchive,
|
|
24
|
+
noimageindex,
|
|
25
|
+
notranslate,
|
|
26
|
+
unavailableAfter
|
|
27
|
+
} = additionalRobotsProps;
|
|
28
|
+
robotsParams = `${nosnippet ? ",nosnippet" : ""}${maxSnippet ? `,max-snippet:${maxSnippet}` : ""}${maxImagePreview ? `,max-image-preview:${maxImagePreview}` : ""}${noarchive ? ",noarchive" : ""}${unavailableAfter ? `,unavailable_after:${unavailableAfter}` : ""}${noimageindex ? ",noimageindex" : ""}${maxVideoPreview ? `,max-video-preview:${maxVideoPreview}` : ""}${notranslate ? ",notranslate" : ""}`;
|
|
29
|
+
}
|
|
30
|
+
$:
|
|
31
|
+
if (!robots && additionalRobotsProps) {
|
|
32
|
+
console.warn("additionalRobotsProps cannot be used when robots is set to false");
|
|
37
33
|
}
|
|
38
34
|
</script>
|
|
39
35
|
|
|
40
36
|
<svelte:head>
|
|
41
37
|
<title>{updatedTitle}</title>
|
|
42
38
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
content={`${noindex ? 'noindex' : 'index'},${nofollow ? 'nofollow' : 'follow'}${robotsParams}`}
|
|
47
|
-
/>
|
|
39
|
+
{#if robots !== false}
|
|
40
|
+
<meta name="robots" content="{robots}{robotsParams}" />
|
|
41
|
+
{/if}
|
|
48
42
|
|
|
49
43
|
{#if description}
|
|
50
44
|
<meta name="description" content={description} />
|
|
@@ -164,7 +158,7 @@
|
|
|
164
158
|
{/each}
|
|
165
159
|
{/if}
|
|
166
160
|
{:else if openGraph.type.toLowerCase() === 'video.movie' || openGraph.type.toLowerCase() === 'video.episode' || openGraph.type.toLowerCase() === 'video.tv_show' || (openGraph.type.toLowerCase() === 'video.other' && openGraph.video)}
|
|
167
|
-
{#if openGraph.video
|
|
161
|
+
{#if openGraph.video?.actors && openGraph.video.actors.length}
|
|
168
162
|
{#each openGraph.video.actors as actor}
|
|
169
163
|
{#if actor.profile}
|
|
170
164
|
<meta property="video:actor" content={actor.profile} />
|
|
@@ -175,33 +169,33 @@
|
|
|
175
169
|
{/each}
|
|
176
170
|
{/if}
|
|
177
171
|
|
|
178
|
-
{#if openGraph.video
|
|
172
|
+
{#if openGraph.video?.directors && openGraph.video.directors.length}
|
|
179
173
|
{#each openGraph.video.directors as director}
|
|
180
174
|
<meta property="video:director" content={director} />
|
|
181
175
|
{/each}
|
|
182
176
|
{/if}
|
|
183
177
|
|
|
184
|
-
{#if openGraph.video
|
|
178
|
+
{#if openGraph.video?.writers && openGraph.video.writers.length}
|
|
185
179
|
{#each openGraph.video.writers as writer}
|
|
186
180
|
<meta property="video:writer" content={writer} />
|
|
187
181
|
{/each}
|
|
188
182
|
{/if}
|
|
189
183
|
|
|
190
|
-
{#if openGraph.video
|
|
184
|
+
{#if openGraph.video?.duration}
|
|
191
185
|
<meta property="video:duration" content={openGraph.video.duration.toString()} />
|
|
192
186
|
{/if}
|
|
193
187
|
|
|
194
|
-
{#if openGraph.video
|
|
188
|
+
{#if openGraph.video?.releaseDate}
|
|
195
189
|
<meta property="video:release_date" content={openGraph.video.releaseDate} />
|
|
196
190
|
{/if}
|
|
197
191
|
|
|
198
|
-
{#if openGraph.video
|
|
192
|
+
{#if openGraph.video?.tags && openGraph.video.tags.length}
|
|
199
193
|
{#each openGraph.video.tags as tag}
|
|
200
194
|
<meta property="video:tag" content={tag} />
|
|
201
195
|
{/each}
|
|
202
196
|
{/if}
|
|
203
197
|
|
|
204
|
-
{#if openGraph.video
|
|
198
|
+
{#if openGraph.video?.series}
|
|
205
199
|
<meta property="video:series" content={openGraph.video.series} />
|
|
206
200
|
{/if}
|
|
207
201
|
{/if}
|
|
@@ -260,7 +254,7 @@
|
|
|
260
254
|
{/if}
|
|
261
255
|
{/if}
|
|
262
256
|
|
|
263
|
-
{#if additionalMetaTags && additionalMetaTags
|
|
257
|
+
{#if additionalMetaTags && Array.isArray(additionalMetaTags)}
|
|
264
258
|
{#each additionalMetaTags as tag}
|
|
265
259
|
<meta {...tag} />
|
|
266
260
|
{/each}
|
|
@@ -1,4 +1,29 @@
|
|
|
1
|
-
import { SvelteComponentTyped } from
|
|
2
|
-
import { MetaTagsProps } from './types';
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { MetaTagsProps } from './types';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
title?: MetaTagsProps['title'];
|
|
6
|
+
titleTemplate?: MetaTagsProps['titleTemplate'];
|
|
7
|
+
robots?: MetaTagsProps['robots'];
|
|
8
|
+
additionalRobotsProps?: MetaTagsProps['additionalRobotsProps'];
|
|
9
|
+
description?: MetaTagsProps['description'];
|
|
10
|
+
mobileAlternate?: MetaTagsProps['mobileAlternate'];
|
|
11
|
+
languageAlternates?: MetaTagsProps['languageAlternates'];
|
|
12
|
+
twitter?: MetaTagsProps['twitter'];
|
|
13
|
+
facebook?: MetaTagsProps['facebook'];
|
|
14
|
+
openGraph?: MetaTagsProps['openGraph'];
|
|
15
|
+
canonical?: MetaTagsProps['canonical'];
|
|
16
|
+
additionalMetaTags?: MetaTagsProps['additionalRobotsProps'];
|
|
17
|
+
additionalLinkTags?: MetaTagsProps['additionalLinkTags'];
|
|
18
|
+
};
|
|
19
|
+
events: {
|
|
20
|
+
[evt: string]: CustomEvent<any>;
|
|
21
|
+
};
|
|
22
|
+
slots: {};
|
|
23
|
+
};
|
|
24
|
+
type MetaTagsProps_ = typeof __propDef.props;
|
|
25
|
+
export { MetaTagsProps_ as MetaTagsProps };
|
|
26
|
+
export type MetaTagsEvents = typeof __propDef.events;
|
|
27
|
+
export type MetaTagsSlots = typeof __propDef.slots;
|
|
28
|
+
export default class MetaTags extends SvelteComponentTyped<MetaTagsProps, MetaTagsEvents, MetaTagsSlots> {
|
|
29
|
+
}
|
package/dist/types.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export interface AdditionalRobotsProps {
|
|
|
20
20
|
noimageindex?: boolean;
|
|
21
21
|
notranslate?: boolean;
|
|
22
22
|
}
|
|
23
|
+
|
|
23
24
|
export interface Twitter {
|
|
24
25
|
cardType?: 'summary' | 'summary_large_image' | 'app' | 'player';
|
|
25
26
|
site?: string;
|
|
@@ -39,8 +40,9 @@ export interface OpenGraph {
|
|
|
39
40
|
type?: string;
|
|
40
41
|
title?: string;
|
|
41
42
|
description?: string;
|
|
42
|
-
images?: ReadonlyArray<
|
|
43
|
-
videos?: ReadonlyArray<
|
|
43
|
+
images?: ReadonlyArray<OpenGraphMedia>;
|
|
44
|
+
videos?: ReadonlyArray<OpenGraphMedia>;
|
|
45
|
+
audio?: ReadonlyArray<OpenGraphMedia>;
|
|
44
46
|
locale?: string;
|
|
45
47
|
site_name?: string;
|
|
46
48
|
profile?: OpenGraphProfile;
|
|
@@ -48,20 +50,16 @@ export interface OpenGraph {
|
|
|
48
50
|
article?: OpenGraphArticle;
|
|
49
51
|
video?: OpenGraphVideo;
|
|
50
52
|
}
|
|
51
|
-
|
|
53
|
+
|
|
54
|
+
interface OpenGraphMedia {
|
|
52
55
|
url: string;
|
|
53
|
-
alt?: string;
|
|
54
56
|
width?: number;
|
|
55
57
|
height?: number;
|
|
56
|
-
}
|
|
57
|
-
interface OpenGraphVideos {
|
|
58
|
-
url: string;
|
|
59
58
|
alt?: string;
|
|
60
|
-
width?: number;
|
|
61
|
-
height?: number;
|
|
62
|
-
secureUrl?: string;
|
|
63
59
|
type?: string;
|
|
60
|
+
secureUrl?: string;
|
|
64
61
|
}
|
|
62
|
+
|
|
65
63
|
interface OpenGraphProfile {
|
|
66
64
|
firstName?: string;
|
|
67
65
|
lastName?: string;
|
|
@@ -75,6 +73,7 @@ interface OpenGraphBook {
|
|
|
75
73
|
releaseDate?: string;
|
|
76
74
|
tags?: ReadonlyArray<string>;
|
|
77
75
|
}
|
|
76
|
+
|
|
78
77
|
interface OpenGraphArticle {
|
|
79
78
|
publishedTime?: string;
|
|
80
79
|
modifiedTime?: string;
|
|
@@ -126,17 +125,21 @@ export type MetaTag = HTML5MetaTag | RDFaMetaTag | HTTPEquivMetaTag;
|
|
|
126
125
|
export interface LinkTag {
|
|
127
126
|
rel: string;
|
|
128
127
|
href: string;
|
|
128
|
+
hrefLang?: string;
|
|
129
|
+
media?: string;
|
|
129
130
|
sizes?: string;
|
|
130
131
|
type?: string;
|
|
131
132
|
color?: string;
|
|
133
|
+
as?: string;
|
|
134
|
+
crossOrigin?: string;
|
|
135
|
+
referrerPolicy?: string;
|
|
132
136
|
}
|
|
133
137
|
|
|
134
138
|
export interface MetaTagsProps {
|
|
135
139
|
title?: string;
|
|
136
140
|
titleTemplate?: string;
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
robotsProps?: AdditionalRobotsProps;
|
|
141
|
+
robots?: string | boolean;
|
|
142
|
+
additionalRobotsProps?: AdditionalRobotsProps;
|
|
140
143
|
description?: string;
|
|
141
144
|
canonical?: string;
|
|
142
145
|
mobileAlternate?: MobileAlternate;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svelte-meta-tags",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Svelte Meta Tags
|
|
3
|
+
"version": "3.0.0",
|
|
4
|
+
"description": "Svelte Meta Tags provides components designed to help you manage SEO for Svelte projects",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"keywords": [
|
|
@@ -21,29 +21,18 @@
|
|
|
21
21
|
"schema-dts": "^1.1.2"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@
|
|
25
|
-
"@
|
|
26
|
-
"@sveltejs/
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"eslint-plugin-svelte": "^2.27.4",
|
|
34
|
-
"husky": "^8.0.3",
|
|
35
|
-
"lint-staged": "^13.2.2",
|
|
36
|
-
"prettier": "^2.8.8",
|
|
37
|
-
"prettier-plugin-svelte": "^2.10.0",
|
|
38
|
-
"publint": "^0.1.11",
|
|
39
|
-
"svelte": "^3.59.1",
|
|
40
|
-
"svelte-check": "^3.3.2",
|
|
41
|
-
"tslib": "^2.5.0",
|
|
42
|
-
"typescript": "^5.0.4",
|
|
43
|
-
"vite": "^4.3.5"
|
|
24
|
+
"@sveltejs/adapter-auto": "^2.1.0",
|
|
25
|
+
"@sveltejs/kit": "^1.22.6",
|
|
26
|
+
"@sveltejs/package": "^2.2.1",
|
|
27
|
+
"publint": "^0.2.1",
|
|
28
|
+
"svelte": "^4.2.0",
|
|
29
|
+
"svelte-check": "^3.5.0",
|
|
30
|
+
"tslib": "^2.6.2",
|
|
31
|
+
"typescript": "^5.1.6",
|
|
32
|
+
"vite": "^4.4.9"
|
|
44
33
|
},
|
|
45
34
|
"peerDependencies": {
|
|
46
|
-
"svelte": "^3.
|
|
35
|
+
"svelte": "^3.55.0 || ^4.0.0"
|
|
47
36
|
},
|
|
48
37
|
"exports": {
|
|
49
38
|
"./JsonLd.svelte": {
|
|
@@ -70,10 +59,6 @@
|
|
|
70
59
|
"preview": "vite preview",
|
|
71
60
|
"package": "svelte-kit sync && svelte-package && publint",
|
|
72
61
|
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
|
73
|
-
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch"
|
|
74
|
-
"lint": "prettier --plugin-search-dir . --check . && eslint .",
|
|
75
|
-
"format": "prettier --plugin-search-dir . --write .",
|
|
76
|
-
"test": "playwright test",
|
|
77
|
-
"release": "changeset publish"
|
|
62
|
+
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch"
|
|
78
63
|
}
|
|
79
64
|
}
|