@nekm/svelte-core 1.0.7 → 1.0.9

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.
@@ -4,4 +4,4 @@ declare global {
4
4
  dataLayer: unknown[];
5
5
  }
6
6
  }
7
- export declare function gtag(event: string, params?: Record<string, unknown>): void;
7
+ export declare function gtag(command: string, event: string, params?: Record<string, unknown>): void;
@@ -1,5 +1,5 @@
1
1
  import { browserAssert } from "@nekm/core";
2
- export function gtag(event, params) {
2
+ export function gtag(command, event, params) {
3
3
  browserAssert();
4
- window.gtag("event", event, params);
4
+ window.gtag(command, event, params);
5
5
  }
package/dist/seo.svelte CHANGED
@@ -8,16 +8,20 @@
8
8
  }
9
9
 
10
10
  export interface SeoProps {
11
- readonly appName: string;
11
+ readonly siteTitle: string;
12
12
  readonly description: string;
13
- readonly title: string;
13
+ readonly pageTitle: string;
14
+ readonly siteAndPageTitle?: {
15
+ readonly items: ReadonlyArray<string>;
16
+ readonly separator?: string;
17
+ }
14
18
  readonly icon: string;
15
19
  readonly canonical?: SeoCanonical;
16
20
  readonly next?: SeoCanonical;
17
21
  readonly baseUrl?: string;
18
22
  }
19
23
 
20
- const { appName, description, title, icon, canonical, next, baseUrl }: SeoProps = $props();
24
+ const { siteTitle, description, pageTitle, icon, canonical, next, baseUrl, siteAndPageTitle }: SeoProps = $props();
21
25
 
22
26
  function createCanonical(canonical?: SeoCanonical, includeBaseUrl = false): string | undefined {
23
27
  let url;
@@ -48,10 +52,14 @@
48
52
  $effect(() => {
49
53
  nextUrl = createCanonical(next);
50
54
  });
55
+
56
+ const metaTitle = !siteAndPageTitle
57
+ ? `${siteTitle} - ${siteTitle}`
58
+ : siteAndPageTitle.items.join(siteAndPageTitle.separator ?? "-");
51
59
  </script>
52
60
 
53
61
  <svelte:head>
54
- <title>{appName} &raquo; {title}</title>
62
+ <title>{metaTitle}</title>
55
63
  <meta name="description" content={description} />
56
64
  <link rel="canonical" href={canonicalUrl} />
57
65
 
@@ -59,20 +67,20 @@
59
67
  <link rel="next" href={nextUrl} />
60
68
  {/if}
61
69
 
62
- <meta property="og:site_name" content={appName} />
63
- <meta property="og:title" content={title} />
70
+ <meta property="og:site_name" content={siteTitle} />
71
+ <meta property="og:title" content={pageTitle} />
64
72
  <meta property="og:description" content={description} />
65
73
  <meta property="og:image" content={icon} />
66
74
  <meta property="og:image:secure_url" content={icon} />
67
75
  <meta property="og:image:width" content="1024" />
68
76
  <meta property="og:image:height" content="1024" />
69
77
  <meta property="og:image:type" content="image/png" />
70
- <meta property="og:image:alt" content={`${appName} logo`} />
78
+ <meta property="og:image:alt" content={`${siteTitle} logo`} />
71
79
  <meta property="og:url" content={canonicalUrl} />
72
80
  <meta property="og:type" content="website" />
73
81
 
74
82
  <meta name="twitter:card" content="summary_large_image">
75
- <meta name="twitter:title" content={title} />
83
+ <meta name="twitter:title" content={pageTitle} />
76
84
  <meta name="twitter:description" content={description} />
77
85
  <meta name="twitter:image" content={icon} />
78
86
  <meta name="twitter:creator" content="@iamBraska" />
@@ -4,9 +4,13 @@ export interface SeoCanonical {
4
4
  readonly queryParams?: QueryParams;
5
5
  }
6
6
  export interface SeoProps {
7
- readonly appName: string;
7
+ readonly siteTitle: string;
8
8
  readonly description: string;
9
- readonly title: string;
9
+ readonly pageTitle: string;
10
+ readonly siteAndPageTitle?: {
11
+ readonly items: ReadonlyArray<string>;
12
+ readonly separator?: string;
13
+ };
10
14
  readonly icon: string;
11
15
  readonly canonical?: SeoCanonical;
12
16
  readonly next?: SeoCanonical;
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@nekm/svelte-core",
3
- "version": "1.0.7",
3
+ "description": "Code I find myself re-writing over-and-over, Svelte edition.",
4
+ "version": "1.0.9",
4
5
  "scripts": {
5
6
  "dev": "vite dev",
6
7
  "build": "vite build && npm run prepack",