svelte-meta-tags 3.1.0 → 3.1.2
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 +52 -22
- package/dist/JsonLd.svelte.d.ts +1 -1
- package/dist/MetaTags.svelte +5 -1
- package/dist/MetaTags.svelte.d.ts +1 -1
- package/package.json +10 -9
package/README.md
CHANGED
|
@@ -125,50 +125,80 @@ pnpm add -D svelte-meta-tags
|
|
|
125
125
|
|
|
126
126
|
**Overwriting default values with a child page:**
|
|
127
127
|
|
|
128
|
+
[Example](https://github.com/oekazuma/svelte-meta-tags/tree/main/example)
|
|
129
|
+
|
|
128
130
|
`+layout.svelte`
|
|
129
131
|
|
|
130
132
|
```svelte
|
|
131
133
|
<script>
|
|
132
|
-
import { MetaTags } from 'svelte-meta-tags';
|
|
133
|
-
import { page } from '$app/stores';
|
|
134
|
+
import { MetaTags } from 'svelte-meta-tags';
|
|
135
|
+
import { page } from '$app/stores';
|
|
136
|
+
import extend from 'just-extend'; // Please provide functions that allow deep merging of objects, such as lodash.merge, deepmerge, just-extend.
|
|
134
137
|
|
|
135
|
-
export let data;
|
|
138
|
+
export let data;
|
|
136
139
|
|
|
137
|
-
|
|
138
|
-
$: metaTags = {
|
|
139
|
-
titleTemplate: '%s | Svelte Meta Tags', // Default title template.
|
|
140
|
-
description: 'Default Description for the Website', // Default description.
|
|
141
|
-
...$page.data.metaTagsChild // Override with child page meta tags if they exist.
|
|
142
|
-
};
|
|
140
|
+
$: metaTags = extend(true, {}, data.baseMetaTags, $page.data.pageMetaTags);
|
|
143
141
|
</script>
|
|
144
142
|
|
|
145
143
|
<MetaTags {...metaTags} />
|
|
146
144
|
|
|
147
|
-
|
|
145
|
+
<slot />
|
|
148
146
|
```
|
|
149
147
|
|
|
150
|
-
`+
|
|
148
|
+
`+layout.ts`
|
|
151
149
|
|
|
152
150
|
```ts
|
|
153
|
-
import type { MetaTagsProps } from 'svelte-meta-tags';
|
|
154
|
-
|
|
155
|
-
export const load =
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
description: '
|
|
151
|
+
import type { MetaTagsProps } from 'svelte-meta-tags';
|
|
152
|
+
|
|
153
|
+
export const load = ({ url }) => {
|
|
154
|
+
const baseMetaTags = Object.freeze({
|
|
155
|
+
title: 'Default',
|
|
156
|
+
titleTemplate: '%s | Svelte Meta Tags',
|
|
157
|
+
description: 'Svelte Meta Tags is a Svelte component for managing meta tags and SEO in your Svelte applications.',
|
|
158
|
+
canonical: new URL(url.pathname, url.origin).href,
|
|
160
159
|
openGraph: {
|
|
161
|
-
// OpenGraph meta tags specific to this page.
|
|
162
160
|
type: 'website',
|
|
163
161
|
url: new URL(url.pathname, url.origin).href,
|
|
164
162
|
locale: 'en_IE',
|
|
165
163
|
title: 'Open Graph Title',
|
|
166
|
-
description: 'Open Graph Description'
|
|
164
|
+
description: 'Open Graph Description',
|
|
165
|
+
siteName: 'SiteName',
|
|
166
|
+
images: [
|
|
167
|
+
{
|
|
168
|
+
url: 'https://www.example.ie/og-image.jpg',
|
|
169
|
+
alt: 'Og Image Alt',
|
|
170
|
+
width: 800,
|
|
171
|
+
height: 600,
|
|
172
|
+
secureUrl: 'https://www.example.ie/og-image.jpg',
|
|
173
|
+
type: 'image/jpeg'
|
|
174
|
+
}
|
|
175
|
+
]
|
|
176
|
+
}
|
|
177
|
+
}) satisfies MetaTagsProps;
|
|
178
|
+
|
|
179
|
+
return {
|
|
180
|
+
baseMetaTags
|
|
181
|
+
};
|
|
182
|
+
};
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
`+page.ts`
|
|
186
|
+
|
|
187
|
+
```ts
|
|
188
|
+
import type { MetaTagsProps } from 'svelte-meta-tags';
|
|
189
|
+
|
|
190
|
+
export const load = () => {
|
|
191
|
+
const pageMetaTags = Object.freeze({
|
|
192
|
+
title: 'TOP',
|
|
193
|
+
description: 'Description TOP',
|
|
194
|
+
openGraph: {
|
|
195
|
+
title: 'Open Graph Title TOP',
|
|
196
|
+
description: 'Open Graph Description TOP'
|
|
167
197
|
}
|
|
168
|
-
});
|
|
198
|
+
}) satisfies MetaTagsProps;
|
|
169
199
|
|
|
170
200
|
return {
|
|
171
|
-
|
|
201
|
+
pageMetaTags
|
|
172
202
|
};
|
|
173
203
|
};
|
|
174
204
|
```
|
package/dist/JsonLd.svelte.d.ts
CHANGED
|
@@ -14,5 +14,5 @@ type JsonLdProps_ = typeof __propDef.props;
|
|
|
14
14
|
export { JsonLdProps_ as JsonLdProps };
|
|
15
15
|
export type JsonLdEvents = typeof __propDef.events;
|
|
16
16
|
export type JsonLdSlots = typeof __propDef.slots;
|
|
17
|
-
export default class JsonLd extends SvelteComponentTyped<
|
|
17
|
+
export default class JsonLd extends SvelteComponentTyped<JsonLdProps_, JsonLdEvents, JsonLdSlots> {
|
|
18
18
|
}
|
package/dist/MetaTags.svelte
CHANGED
|
@@ -35,7 +35,11 @@ $:
|
|
|
35
35
|
</script>
|
|
36
36
|
|
|
37
37
|
<svelte:head>
|
|
38
|
-
|
|
38
|
+
{#key updatedTitle}
|
|
39
|
+
{#if updatedTitle}
|
|
40
|
+
<title>{updatedTitle}</title>
|
|
41
|
+
{/if}
|
|
42
|
+
{/key}
|
|
39
43
|
|
|
40
44
|
{#if robots !== false}
|
|
41
45
|
<meta name="robots" content="{robots}{robotsParams}" />
|
|
@@ -26,5 +26,5 @@ type MetaTagsProps_ = typeof __propDef.props;
|
|
|
26
26
|
export { MetaTagsProps_ as MetaTagsProps };
|
|
27
27
|
export type MetaTagsEvents = typeof __propDef.events;
|
|
28
28
|
export type MetaTagsSlots = typeof __propDef.slots;
|
|
29
|
-
export default class MetaTags extends SvelteComponentTyped<
|
|
29
|
+
export default class MetaTags extends SvelteComponentTyped<MetaTagsProps_, MetaTagsEvents, MetaTagsSlots> {
|
|
30
30
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svelte-meta-tags",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.2",
|
|
4
4
|
"description": "Svelte Meta Tags provides components designed to help you manage SEO for Svelte projects",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -21,15 +21,16 @@
|
|
|
21
21
|
"schema-dts": "^1.1.2"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@sveltejs/adapter-auto": "^2.
|
|
25
|
-
"@sveltejs/kit": "^
|
|
26
|
-
"@sveltejs/package": "^2.
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"svelte
|
|
24
|
+
"@sveltejs/adapter-auto": "^3.2.0",
|
|
25
|
+
"@sveltejs/kit": "^2.5.5",
|
|
26
|
+
"@sveltejs/package": "^2.3.1",
|
|
27
|
+
"@sveltejs/vite-plugin-svelte": "^3.0.2",
|
|
28
|
+
"publint": "^0.2.7",
|
|
29
|
+
"svelte": "^4.2.12",
|
|
30
|
+
"svelte-check": "^3.6.9",
|
|
30
31
|
"tslib": "^2.6.2",
|
|
31
|
-
"typescript": "^5.
|
|
32
|
-
"vite": "^
|
|
32
|
+
"typescript": "^5.4.4",
|
|
33
|
+
"vite": "^5.2.8"
|
|
33
34
|
},
|
|
34
35
|
"peerDependencies": {
|
|
35
36
|
"svelte": "^3.55.0 || ^4.0.0"
|