svelte-meta-tags 5.0.0 → 5.0.1

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.
@@ -18,7 +18,7 @@
18
18
  additionalLinkTags = undefined
19
19
  }: Partial<MetaTagsProps> = $props();
20
20
 
21
- let updatedTitle = $derived(titleTemplate ? (title ? titleTemplate.replace(/%s/g, title) : title) : title);
21
+ let updatedTitle = $derived(title && (titleTemplate?.replace(/%s/g, title) ?? title));
22
22
 
23
23
  let robotsParams = $derived.by(() => {
24
24
  if (!additionalRobotsProps) return '';
@@ -72,11 +72,9 @@
72
72
  <link rel="alternate" media={mobileAlternate.media} href={mobileAlternate.href} />
73
73
  {/if}
74
74
 
75
- {#if languageAlternates && languageAlternates.length > 0}
76
- {#each languageAlternates as languageAlternate (languageAlternate)}
77
- <link rel="alternate" hrefLang={languageAlternate.hrefLang} href={languageAlternate.href} />
78
- {/each}
79
- {/if}
75
+ {#each languageAlternates as languageAlternate (languageAlternate)}
76
+ <link rel="alternate" hrefLang={languageAlternate.hrefLang} href={languageAlternate.href} />
77
+ {/each}
80
78
 
81
79
  {#if twitter}
82
80
  {#if twitter.cardType}
@@ -172,11 +170,9 @@
172
170
  <meta property="profile:gender" content={openGraph.profile.gender} />
173
171
  {/if}
174
172
  {:else if openGraph.type.toLowerCase() === 'book' && openGraph.book}
175
- {#if openGraph.book.authors && openGraph.book.authors.length}
176
- {#each openGraph.book.authors as author (author)}
177
- <meta property="book:author" content={author} />
178
- {/each}
179
- {/if}
173
+ {#each openGraph.book?.authors as author (author)}
174
+ <meta property="book:author" content={author} />
175
+ {/each}
180
176
 
181
177
  {#if openGraph.book.isbn}
182
178
  <meta property="book:isbn" content={openGraph.book.isbn} />
@@ -186,11 +182,9 @@
186
182
  <meta property="book:release_date" content={openGraph.book.releaseDate} />
187
183
  {/if}
188
184
 
189
- {#if openGraph.book.tags && openGraph.book.tags.length}
190
- {#each openGraph.book.tags as tag (tag)}
191
- <meta property="book:tag" content={tag} />
192
- {/each}
193
- {/if}
185
+ {#each openGraph.book?.tags as tag (tag)}
186
+ <meta property="book:tag" content={tag} />
187
+ {/each}
194
188
  {:else if openGraph.type.toLowerCase() === 'article' && openGraph.article}
195
189
  {#if openGraph.article.publishedTime}
196
190
  <meta property="article:published_time" content={openGraph.article.publishedTime} />
@@ -204,44 +198,34 @@
204
198
  <meta property="article:expiration_time" content={openGraph.article.expirationTime} />
205
199
  {/if}
206
200
 
207
- {#if openGraph.article.authors && openGraph.article.authors.length}
208
- {#each openGraph.article.authors as author (author)}
209
- <meta property="article:author" content={author} />
210
- {/each}
211
- {/if}
201
+ {#each openGraph.article?.authors as author (author)}
202
+ <meta property="article:author" content={author} />
203
+ {/each}
212
204
 
213
205
  {#if openGraph.article.section}
214
206
  <meta property="article:section" content={openGraph.article.section} />
215
207
  {/if}
216
208
 
217
- {#if openGraph.article.tags && openGraph.article.tags.length}
218
- {#each openGraph.article.tags as tag (tag)}
219
- <meta property="article:tag" content={tag} />
220
- {/each}
221
- {/if}
222
- {: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)}
223
- {#if openGraph.video?.actors && openGraph.video.actors.length}
224
- {#each openGraph.video.actors as actor (actor)}
225
- {#if actor.profile}
226
- <meta property="video:actor" content={actor.profile} />
227
- {/if}
228
- {#if actor.role}
229
- <meta property="video:actor:role" content={actor.role} />
230
- {/if}
231
- {/each}
232
- {/if}
209
+ {#each openGraph.article?.tags as tag (tag)}
210
+ <meta property="article:tag" content={tag} />
211
+ {/each}
212
+ {:else if ['video.movie', 'video.episode', 'video.tv_show'].includes(openGraph.type.toLowerCase()) || (openGraph.type.toLowerCase() === 'video.other' && openGraph.video)}
213
+ {#each openGraph.video?.actors as actor (actor)}
214
+ {#if actor.profile}
215
+ <meta property="video:actor" content={actor.profile} />
216
+ {/if}
217
+ {#if actor.role}
218
+ <meta property="video:actor:role" content={actor.role} />
219
+ {/if}
220
+ {/each}
233
221
 
234
- {#if openGraph.video?.directors && openGraph.video.directors.length}
235
- {#each openGraph.video.directors as director (director)}
236
- <meta property="video:director" content={director} />
237
- {/each}
238
- {/if}
222
+ {#each openGraph.video?.directors as director (director)}
223
+ <meta property="video:director" content={director} />
224
+ {/each}
239
225
 
240
- {#if openGraph.video?.writers && openGraph.video.writers.length}
241
- {#each openGraph.video.writers as writer (writer)}
242
- <meta property="video:writer" content={writer} />
243
- {/each}
244
- {/if}
226
+ {#each openGraph.video?.writers as writer (writer)}
227
+ <meta property="video:writer" content={writer} />
228
+ {/each}
245
229
 
246
230
  {#if openGraph.video?.duration}
247
231
  <meta property="video:duration" content={openGraph.video.duration.toString()} />
@@ -251,11 +235,9 @@
251
235
  <meta property="video:release_date" content={openGraph.video.releaseDate} />
252
236
  {/if}
253
237
 
254
- {#if openGraph.video?.tags && openGraph.video.tags.length}
255
- {#each openGraph.video.tags as tag (tag)}
256
- <meta property="video:tag" content={tag} />
257
- {/each}
258
- {/if}
238
+ {#each openGraph.video?.tags as tag (tag)}
239
+ <meta property="video:tag" content={tag} />
240
+ {/each}
259
241
 
260
242
  {#if openGraph.video?.series}
261
243
  <meta property="video:series" content={openGraph.video.series} />
@@ -271,7 +253,7 @@
271
253
  <meta property="og:description" content={openGraph.description || description} />
272
254
  {/if}
273
255
 
274
- {#if openGraph.image || (openGraph.images && openGraph.images.length)}
256
+ {#if openGraph.image || openGraph.images?.length}
275
257
  {@const ogImages = openGraph.image ? [openGraph.image, ...(openGraph.images || [])] : openGraph.images}
276
258
  {#each ogImages as image (image)}
277
259
  <meta property="og:image" content={image.url} />
@@ -293,35 +275,31 @@
293
275
  {/each}
294
276
  {/if}
295
277
 
296
- {#if openGraph.videos && openGraph.videos.length}
297
- {#each openGraph.videos as video (video)}
298
- <meta property="og:video" content={video.url} />
299
- {#if video.width}
300
- <meta property="og:video:width" content={video.width.toString()} />
301
- {/if}
302
- {#if video.height}
303
- <meta property="og:video:height" content={video.height.toString()} />
304
- {/if}
305
- {#if video.secureUrl}
306
- <meta property="og:video:secure_url" content={video.secureUrl.toString()} />
307
- {/if}
308
- {#if video.type}
309
- <meta property="og:video:type" content={video.type.toString()} />
310
- {/if}
311
- {/each}
312
- {/if}
278
+ {#each openGraph.videos as video (video)}
279
+ <meta property="og:video" content={video.url} />
280
+ {#if video.width}
281
+ <meta property="og:video:width" content={video.width.toString()} />
282
+ {/if}
283
+ {#if video.height}
284
+ <meta property="og:video:height" content={video.height.toString()} />
285
+ {/if}
286
+ {#if video.secureUrl}
287
+ <meta property="og:video:secure_url" content={video.secureUrl.toString()} />
288
+ {/if}
289
+ {#if video.type}
290
+ <meta property="og:video:type" content={video.type.toString()} />
291
+ {/if}
292
+ {/each}
313
293
 
314
- {#if openGraph.audio && openGraph.audio.length}
315
- {#each openGraph.audio as audio (audio)}
316
- <meta property="og:audio" content={audio.url} />
317
- {#if audio.secureUrl}
318
- <meta property="og:audio:secure_url" content={audio.secureUrl.toString()} />
319
- {/if}
320
- {#if audio.type}
321
- <meta property="og:audio:type" content={audio.type.toString()} />
322
- {/if}
323
- {/each}
324
- {/if}
294
+ {#each openGraph.audio as audio (audio)}
295
+ <meta property="og:audio" content={audio.url} />
296
+ {#if audio.secureUrl}
297
+ <meta property="og:audio:secure_url" content={audio.secureUrl.toString()} />
298
+ {/if}
299
+ {#if audio.type}
300
+ <meta property="og:audio:type" content={audio.type.toString()} />
301
+ {/if}
302
+ {/each}
325
303
 
326
304
  {#if openGraph.locale}
327
305
  <meta property="og:locale" content={openGraph.locale} />
@@ -332,15 +310,12 @@
332
310
  {/if}
333
311
  {/if}
334
312
 
335
- {#if additionalMetaTags && Array.isArray(additionalMetaTags)}
336
- {#each additionalMetaTags as tag (tag)}
337
- <meta {...tag.httpEquiv ? { ...tag, 'http-equiv': tag.httpEquiv } : tag} />
338
- {/each}
339
- {/if}
313
+ {#each additionalMetaTags as tag (tag)}
314
+ {@const { httpEquiv, ...metaTag } = tag}
315
+ <meta {...httpEquiv ? { ...metaTag, 'http-equiv': httpEquiv } : metaTag} />
316
+ {/each}
340
317
 
341
- {#if additionalLinkTags?.length}
342
- {#each additionalLinkTags as tag (tag)}
343
- <link {...tag} />
344
- {/each}
345
- {/if}
318
+ {#each additionalLinkTags as tag (tag)}
319
+ <link {...tag} />
320
+ {/each}
346
321
  </svelte:head>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelte-meta-tags",
3
- "version": "5.0.0",
3
+ "version": "5.0.1",
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",
@@ -18,21 +18,24 @@
18
18
  "url": "git+https://github.com/oekazuma/svelte-meta-tags.git",
19
19
  "directory": "packages/svelte-meta-tags"
20
20
  },
21
+ "bugs": {
22
+ "url": "https://github.com/oekazuma/svelte-meta-tags/issues"
23
+ },
21
24
  "homepage": "https://oekazuma.github.io/svelte-meta-tags/",
22
25
  "dependencies": {
23
26
  "schema-dts": "^2.0.0"
24
27
  },
25
28
  "devDependencies": {
26
29
  "@sveltejs/adapter-auto": "^7.0.1",
27
- "@sveltejs/kit": "^2.63.0",
30
+ "@sveltejs/kit": "^2.68.0",
28
31
  "@sveltejs/package": "^2.5.8",
29
32
  "@sveltejs/vite-plugin-svelte": "^7.1.2",
30
33
  "publint": "^0.3.21",
31
- "svelte": "^5.56.2",
32
- "svelte-check": "^4.6.0",
34
+ "svelte": "^5.56.4",
35
+ "svelte-check": "^4.7.1",
33
36
  "typescript": "^6.0.3",
34
- "vite": "^8.0.16",
35
- "vitest": "^4.1.8"
37
+ "vite": "^8.1.0",
38
+ "vitest": "^4.1.9"
36
39
  },
37
40
  "peerDependencies": {
38
41
  "svelte": "^5.0.0"