@nekm/svelte-core 1.9.2 → 1.9.4

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/seo.svelte CHANGED
@@ -14,9 +14,9 @@
14
14
 
15
15
  export interface SeoIcon {
16
16
  readonly href: string;
17
+ readonly mimeContentType: string;
17
18
  readonly height: number;
18
19
  readonly width: number;
19
- readonly mimeContentType: string;
20
20
  }
21
21
 
22
22
  export interface SeoTwitter {
@@ -42,9 +42,9 @@
42
42
  description,
43
43
  icon,
44
44
  additionalIcons = [],
45
- canonical,
45
+ canonical = { path: page.url.pathname },
46
46
  next,
47
- origin: propsOrigin,
47
+ origin = page.url.origin,
48
48
  twitter,
49
49
  }: SeoProps = $props();
50
50
 
@@ -52,25 +52,31 @@
52
52
  if (!canonical.path) return origin;
53
53
 
54
54
  const path = strTrimStart(canonical.path, "/");
55
- const canonicalWithPath = `${origin}/${path}`;
55
+ if (path.length <= 0) return origin;
56
56
 
57
+ const canonicalWithPath = `${origin}/${path}`;
57
58
  if (!canonical.queryParams) return canonicalWithPath;
58
59
 
59
60
  return `${canonicalWithPath}?${queryParamsCreate(canonical.queryParams)}`;
60
61
  }
61
62
 
62
- const origin = $derived(propsOrigin ?? page.url.origin);
63
63
  const iconHref = $derived(urlSetOrigin(origin, icon.href));
64
- const canonicalUrl = $derived(
65
- !canonical ? origin : createCanonical(canonical),
66
- );
64
+ const canonicalUrl = $derived(createCanonical(canonical));
67
65
  const nextUrl = $derived(!next ? undefined : createCanonical(next));
66
+ const additionalAppleIcons = $derived(
67
+ additionalIcons.filter((i) => i.mimeContentType === "image/png"),
68
+ );
68
69
  </script>
69
70
 
70
71
  <svelte:head>
71
72
  <title>{pageTitle} | {siteTitle}</title>
72
73
  <meta name="description" content={description} />
74
+
73
75
  <link rel="canonical" href={canonicalUrl} />
76
+ {#if nextUrl}
77
+ <link rel="next" href={nextUrl} />
78
+ {/if}
79
+
74
80
  <link
75
81
  rel="icon"
76
82
  type={icon.mimeContentType}
@@ -78,6 +84,14 @@
78
84
  href={icon.href}
79
85
  />
80
86
 
87
+ {#if icon.mimeContentType === "image/png"}
88
+ <link
89
+ rel="apple-touch-icon"
90
+ sizes="{icon.width}x{icon.height}"
91
+ href={icon.href}
92
+ />
93
+ {/if}
94
+
81
95
  {#each additionalIcons as icon}
82
96
  <link
83
97
  rel="icon"
@@ -87,9 +101,13 @@
87
101
  />
88
102
  {/each}
89
103
 
90
- {#if nextUrl}
91
- <link rel="next" href={nextUrl} />
92
- {/if}
104
+ {#each additionalAppleIcons as icon}
105
+ <link
106
+ rel="apple-touch-icon"
107
+ sizes="{icon.width}x{icon.height}"
108
+ href={icon.href}
109
+ />
110
+ {/each}
93
111
 
94
112
  <meta property="og:site_name" content={siteTitle} />
95
113
  <meta property="og:title" content={pageTitle} />
@@ -5,9 +5,9 @@ export interface SeoCanonical {
5
5
  }
6
6
  export interface SeoIcon {
7
7
  readonly href: string;
8
+ readonly mimeContentType: string;
8
9
  readonly height: number;
9
10
  readonly width: number;
10
- readonly mimeContentType: string;
11
11
  }
12
12
  export interface SeoTwitter {
13
13
  readonly creator?: string;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@nekm/svelte-core",
3
3
  "description": "Code I find myself re-writing over-and-over, Svelte edition.",
4
4
  "license": "MIT",
5
- "version": "1.9.2",
5
+ "version": "1.9.4",
6
6
  "scripts": {
7
7
  "dev": "vite dev",
8
8
  "build": "vite build && npm run prepack",