@nekm/svelte-core 1.0.10 → 1.0.12

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
@@ -1,5 +1,4 @@
1
1
  <script lang="ts">
2
- import {assets} from "$app/paths";
3
2
  import {type QueryParams, queryParamsCreate} from "@nekm/core";
4
3
 
5
4
  export interface SeoCanonical {
@@ -7,27 +6,30 @@
7
6
  readonly queryParams?: QueryParams;
8
7
  }
9
8
 
9
+ export interface SeoIcon {
10
+ readonly href: string;
11
+ readonly height: number;
12
+ readonly width: number;
13
+ readonly mimeContentType: string;
14
+ }
15
+
10
16
  export interface SeoProps {
11
17
  readonly siteTitle: string;
12
- readonly description: string;
13
18
  readonly pageTitle: string;
14
- readonly siteAndPageTitle?: {
15
- readonly items: ReadonlyArray<string>;
16
- readonly separator?: string;
17
- }
18
- readonly icon: string;
19
+ readonly description: string;
20
+ readonly origin: string;
21
+ readonly icon: SeoIcon;
19
22
  readonly canonical?: SeoCanonical;
20
23
  readonly next?: SeoCanonical;
21
- readonly baseUrl?: string;
22
24
  }
23
25
 
24
- const { siteTitle, description, pageTitle, icon, canonical, next, baseUrl, siteAndPageTitle }: SeoProps = $props();
26
+ const { siteTitle, description, pageTitle, icon, canonical, next, origin }: SeoProps = $props();
25
27
 
26
28
  function createCanonical(canonical?: SeoCanonical, includeBaseUrl = false): string | undefined {
27
29
  let url;
28
30
 
29
31
  if (canonical || includeBaseUrl) {
30
- url = baseUrl ?? assets;
32
+ url = origin;
31
33
  }
32
34
 
33
35
  if (canonical?.path) {
@@ -52,14 +54,10 @@
52
54
  $effect(() => {
53
55
  nextUrl = createCanonical(next);
54
56
  });
55
-
56
- const metaTitle = !siteAndPageTitle
57
- ? `${siteTitle} - ${siteTitle}`
58
- : siteAndPageTitle.items.join(siteAndPageTitle.separator ?? " - ");
59
57
  </script>
60
58
 
61
59
  <svelte:head>
62
- <title>{metaTitle}</title>
60
+ <title>{pageTitle} | {siteTitle}</title>
63
61
  <meta name="description" content={description} />
64
62
  <link rel="canonical" href={canonicalUrl} />
65
63
 
@@ -70,11 +68,11 @@
70
68
  <meta property="og:site_name" content={siteTitle} />
71
69
  <meta property="og:title" content={pageTitle} />
72
70
  <meta property="og:description" content={description} />
73
- <meta property="og:image" content={icon} />
74
- <meta property="og:image:secure_url" content={icon} />
75
- <meta property="og:image:width" content="1024" />
76
- <meta property="og:image:height" content="1024" />
77
- <meta property="og:image:type" content="image/png" />
71
+ <meta property="og:image" content={icon.href} />
72
+ <meta property="og:image:secure_url" content={icon.href} />
73
+ <meta property="og:image:width" content={"" + icon.width} />
74
+ <meta property="og:image:height" content={"" + icon.height} />
75
+ <meta property="og:image:type" content={icon.mimeContentType} />
78
76
  <meta property="og:image:alt" content={`${siteTitle} logo`} />
79
77
  <meta property="og:url" content={canonicalUrl} />
80
78
  <meta property="og:type" content="website" />
@@ -82,6 +80,6 @@
82
80
  <meta name="twitter:card" content="summary_large_image">
83
81
  <meta name="twitter:title" content={pageTitle} />
84
82
  <meta name="twitter:description" content={description} />
85
- <meta name="twitter:image" content={icon} />
83
+ <meta name="twitter:image" content={icon.href} />
86
84
  <meta name="twitter:creator" content="@iamBraska" />
87
85
  </svelte:head>
@@ -3,18 +3,20 @@ export interface SeoCanonical {
3
3
  readonly path?: string;
4
4
  readonly queryParams?: QueryParams;
5
5
  }
6
+ export interface SeoIcon {
7
+ readonly href: string;
8
+ readonly height: number;
9
+ readonly width: number;
10
+ readonly mimeContentType: string;
11
+ }
6
12
  export interface SeoProps {
7
13
  readonly siteTitle: string;
8
- readonly description: string;
9
14
  readonly pageTitle: string;
10
- readonly siteAndPageTitle?: {
11
- readonly items: ReadonlyArray<string>;
12
- readonly separator?: string;
13
- };
14
- readonly icon: string;
15
+ readonly description: string;
16
+ readonly origin: string;
17
+ readonly icon: SeoIcon;
15
18
  readonly canonical?: SeoCanonical;
16
19
  readonly next?: SeoCanonical;
17
- readonly baseUrl?: string;
18
20
  }
19
21
  declare const Seo: import("svelte").Component<SeoProps, {}, "">;
20
22
  type Seo = ReturnType<typeof Seo>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nekm/svelte-core",
3
3
  "description": "Code I find myself re-writing over-and-over, Svelte edition.",
4
- "version": "1.0.10",
4
+ "version": "1.0.12",
5
5
  "scripts": {
6
6
  "dev": "vite dev",
7
7
  "build": "vite build && npm run prepack",