@rimelight/seo 0.0.14 → 0.0.15

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.
@@ -6,13 +6,26 @@ const prerender = false;
6
6
  const GET = () => {
7
7
  const siteConfig = siteConfigMod.siteConfig || {};
8
8
  const manifestOpts = typeof seoOptions?.manifest === "object" ? seoOptions.manifest : {};
9
+ let defaultIcons = manifestOpts.icons || siteConfig.branding?.icons;
10
+ if (!defaultIcons) {
11
+ const faviconUrl = siteConfig.branding?.favicon?.svg || siteConfig.branding?.favicon || siteConfig.branding?.appleTouchIcon;
12
+ if (typeof faviconUrl === "string" && (faviconUrl.startsWith("http://") || faviconUrl.startsWith("https://") || faviconUrl.startsWith("/"))) {
13
+ const isSvg = faviconUrl.endsWith(".svg");
14
+ defaultIcons = [{
15
+ src: faviconUrl,
16
+ sizes: isSvg ? "any" : "192x192",
17
+ type: isSvg ? "image/svg+xml" : "image/png",
18
+ purpose: "any"
19
+ }];
20
+ }
21
+ }
9
22
  const manifest = buildWebManifest({
10
23
  name: manifestOpts.name || siteConfig.name || "Site",
11
24
  shortName: manifestOpts.shortName || siteConfig.name || "Site",
12
25
  description: manifestOpts.description || siteConfig.description || "",
13
26
  backgroundColor: manifestOpts.backgroundColor || siteConfig.branding?.colors?.backgroundColor || "#ffffff",
14
27
  themeColor: manifestOpts.themeColor || siteConfig.branding?.colors?.themeColor || "#ffffff",
15
- icons: manifestOpts.icons || siteConfig.branding?.icons,
28
+ icons: defaultIcons,
16
29
  ...manifestOpts
17
30
  });
18
31
  return new Response(JSON.stringify(manifest, null, 2), { headers: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rimelight/seo",
3
- "version": "0.0.14",
3
+ "version": "0.0.15",
4
4
  "private": false,
5
5
  "description": "Rimelight Entertainment's SEO Package",
6
6
  "homepage": "https://rimelight.com/docs",
@@ -73,7 +73,7 @@
73
73
  "access": "public"
74
74
  },
75
75
  "devDependencies": {
76
- "@rimelight/config": "0.0.17",
76
+ "@rimelight/config": "0.0.18",
77
77
  "astro": "7.3.3",
78
78
  "sharp": "^0.35.4",
79
79
  "typescript": "6.0.3"
@@ -92,7 +92,7 @@
92
92
  }
93
93
  },
94
94
  "engines": {
95
- "node": ">=26.8.2"
95
+ "node": ">=26.9.0"
96
96
  },
97
97
  "scripts": {
98
98
  "build": "vp pack",
@@ -9,6 +9,30 @@ export const GET: APIRoute = () => {
9
9
  const siteConfig = siteConfigMod.siteConfig || {}
10
10
  const manifestOpts = typeof seoOptions?.manifest === "object" ? seoOptions.manifest : {}
11
11
 
12
+ let defaultIcons = manifestOpts.icons || siteConfig.branding?.icons
13
+ if (!defaultIcons) {
14
+ const faviconUrl =
15
+ siteConfig.branding?.favicon?.svg ||
16
+ siteConfig.branding?.favicon ||
17
+ siteConfig.branding?.appleTouchIcon
18
+ if (
19
+ typeof faviconUrl === "string" &&
20
+ (faviconUrl.startsWith("http://") ||
21
+ faviconUrl.startsWith("https://") ||
22
+ faviconUrl.startsWith("/"))
23
+ ) {
24
+ const isSvg = faviconUrl.endsWith(".svg")
25
+ defaultIcons = [
26
+ {
27
+ src: faviconUrl,
28
+ sizes: isSvg ? "any" : "192x192",
29
+ type: isSvg ? "image/svg+xml" : "image/png",
30
+ purpose: "any"
31
+ }
32
+ ]
33
+ }
34
+ }
35
+
12
36
  const manifest = buildWebManifest({
13
37
  name: manifestOpts.name || siteConfig.name || "Site",
14
38
  shortName: manifestOpts.shortName || siteConfig.name || "Site",
@@ -16,7 +40,7 @@ export const GET: APIRoute = () => {
16
40
  backgroundColor:
17
41
  manifestOpts.backgroundColor || siteConfig.branding?.colors?.backgroundColor || "#ffffff",
18
42
  themeColor: manifestOpts.themeColor || siteConfig.branding?.colors?.themeColor || "#ffffff",
19
- icons: manifestOpts.icons || siteConfig.branding?.icons,
43
+ icons: defaultIcons,
20
44
  ...manifestOpts
21
45
  })
22
46