@rileybathurst/paddle 0.0.50 → 0.0.52

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/PaddleSEO.tsx +26 -37
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rileybathurst/paddle",
3
3
  "private": false,
4
- "version": "0.0.50",
4
+ "version": "0.0.52",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",
package/src/PaddleSEO.tsx CHANGED
@@ -10,9 +10,6 @@ interface BreadcrumbsTypes {
10
10
  }[]
11
11
  // I could probably pass it two arguments instead but for now
12
12
  function Breadcrumbs(breadcrumbs: BreadcrumbsTypes) {
13
-
14
- // console.log(breadcrumbs);
15
- // console.log(Object.entries(breadcrumbs).length);
16
13
  if (!Object.entries(breadcrumbs).length) return null;
17
14
 
18
15
  // remove the breadcrumbs.url from the Object.entries
@@ -44,13 +41,13 @@ function Breadcrumbs(breadcrumbs: BreadcrumbsTypes) {
44
41
  }
45
42
 
46
43
  type SEOtypes = {
47
- title?: string;
48
- description?: string;
49
- url?: string;
50
- image?: string;
51
- imageAlt?: string;
52
- breadcrumbs?: object;
53
- children?: React.ReactNode;
44
+ title: string;
45
+ description: string;
46
+ url: string;
47
+ ogImage: string;
48
+ ogimagedescription: string;
49
+ breadcrumbs: BreadcrumbsTypes;
50
+ children: React.ReactNode;
54
51
 
55
52
  strapiLocale: {
56
53
  name: string;
@@ -58,13 +55,10 @@ type SEOtypes = {
58
55
  topbar: string;
59
56
  };
60
57
  url: string;
61
- ogImage: string;
62
- ogimagedescription: string;
63
58
  themeColor: string;
64
59
  latitude: string;
65
60
  longitude: string;
66
61
  geoRadius: string;
67
- phone: string;
68
62
  };
69
63
 
70
64
  strapiLocation: {
@@ -72,25 +66,23 @@ type SEOtypes = {
72
66
  addressLocality: string;
73
67
  addressRegion: string;
74
68
  postalCode: string;
69
+ paymentAccepted: string;
70
+ phone: string;
75
71
  opening_time: string;
76
72
  closing_time: string;
77
- paymentAccepted: string;
78
73
  };
79
74
  }
80
75
 
81
- export const SEO = (strapiLocale, strapiLocation: SEOtypes) => {
76
+ export const PaddleSEO = (title, description, image, imageAlt, breadcrumbs, strapiLocale, strapiLocation: SEOtypes) => {
82
77
 
83
78
  const businessName = `${strapiLocale.name} Kayak & Paddleboard rentals and tours`;
84
79
 
85
- const seo = {
86
- title: SE0.title ? `${SE0.title} | ${businessName}` : `${businessName} | ${strapiLocale.topbar.topbar} `,
87
- // TODO: tagline would be a better fallback description
88
- description: SE0.description || businessName,
89
- url: `${strapiLocale.url}${SE0.url}` || strapiLocale.url,
90
- image: strapiLocale.ogImage || SEO.image,
91
- imageAlt: strapiLocale.ogimagedescription || SEO.imageAlt,
92
- breadcrumbs: SE0.breadcrumbs || null,
93
- };
80
+ const PaddleTitle = title ? `${title} | ${businessName}` : `${businessName} | ${strapiLocale.topbar.topbar} `;
81
+ // TODO: tagline would be a better fallback description
82
+ const PaddleDescription = description || businessName;
83
+ // url: `${strapiLocale.url}${SE0.url}` || strapiLocale.url,
84
+ const PaddleImage = image || strapiLocale.ogImage;
85
+ const PaddleImageAlt = imageAlt || strapiLocale.ogimagedescription;
94
86
 
95
87
  // const query = '- cash\n - credit card';
96
88
  // const formatted = query.split('\n').map((item) => item.trim().replace('- ', '')).join(', ');
@@ -103,15 +95,15 @@ export const SEO = (strapiLocale, strapiLocation: SEOtypes) => {
103
95
 
104
96
  return (
105
97
  <>
106
- <title>{seo.title}</title>
107
- <meta name="description" content={seo.description} />
98
+ <title>{PaddleTitle}</title>
99
+ <meta name="description" content={PaddleDescription} />
108
100
 
109
101
  <meta property="og:type" content="website" />
110
- <meta property="og:url" content={seo.url} />
111
- <meta property="og:title" content={seo.title} />
112
- <meta property="og:description" content={seo.description} />
113
- <meta property="og:image" content={seo.image} />
114
- <meta property="og:image:alt" content={seo.imageAlt} />
102
+ {/* <meta property="og:url" content={url} /> */}
103
+ <meta property="og:title" content={PaddleTitle} />
104
+ <meta property="og:description" content={PaddleDescription} />
105
+ <meta property="og:image" content={PaddleImage} />
106
+ <meta property="og:image:alt" content={PaddleImageAlt} />
115
107
  <meta name="theme-color" content={strapiLocale.themeColor} />
116
108
 
117
109
  <Script type="application/ld+json">
@@ -122,7 +114,7 @@ export const SEO = (strapiLocale, strapiLocation: SEOtypes) => {
122
114
  "name": "${businessName}",
123
115
  "url": "${strapiLocale.url}",
124
116
  "description": "${strapiLocale.name}",
125
- "image": "${seo.image}",
117
+ "image": "${PaddleImage}",
126
118
  "address": {
127
119
  "@type": "PostalAddress",
128
120
  "streetAddress": "${strapiLocation.streetAddress}",
@@ -153,11 +145,8 @@ export const SEO = (strapiLocale, strapiLocation: SEOtypes) => {
153
145
  `}
154
146
  </Script>
155
147
 
156
- {/* // ? do I have anything but two levels deep? with this maybe */}
157
- {/* this was being weird inline so i put it in a function i might not need to */}
158
- {/* {seo?.breadcrumbs ?? */}
159
- <Breadcrumbs breadcrumbs={seo.breadcrumbs} />
160
- {SE0.children}
148
+ <Breadcrumbs {...breadcrumbs} />
149
+ {/* {SE0.children} */}
161
150
  </>
162
151
  );
163
152
  };