@rimelight/seo 0.0.5 → 0.0.7

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 (74) hide show
  1. package/dist/assets.d.mts +39 -0
  2. package/dist/assets.mjs +96 -0
  3. package/dist/catalog.d.mts +7 -0
  4. package/dist/catalog.mjs +10 -0
  5. package/dist/index.d.mts +9 -3
  6. package/dist/index.mjs +10 -2
  7. package/dist/integration.d.mts +3 -20
  8. package/dist/integration.mjs +257 -7
  9. package/dist/manifest.d.mts +7 -0
  10. package/dist/manifest.mjs +44 -0
  11. package/dist/og.d.mts +117 -0
  12. package/dist/og.mjs +302 -0
  13. package/dist/routes/api-catalog.d.mts +5 -0
  14. package/dist/routes/api-catalog.mjs +38 -0
  15. package/dist/routes/apple-touch-icon.png.d.mts +5 -0
  16. package/dist/routes/apple-touch-icon.png.mjs +17 -0
  17. package/dist/routes/favicon.ico.d.mts +5 -0
  18. package/dist/routes/favicon.ico.mjs +14 -0
  19. package/dist/routes/favicon.svg.d.mts +5 -0
  20. package/dist/routes/favicon.svg.mjs +12 -0
  21. package/dist/routes/icon-192.png.d.mts +5 -0
  22. package/dist/routes/icon-192.png.mjs +17 -0
  23. package/dist/routes/icon-512.png.d.mts +5 -0
  24. package/dist/routes/icon-512.png.mjs +17 -0
  25. package/dist/routes/icon-maskable-512.png.d.mts +5 -0
  26. package/dist/routes/icon-maskable-512.png.mjs +18 -0
  27. package/dist/routes/llms-full.txt.d.mts +5 -0
  28. package/dist/routes/llms-full.txt.mjs +57 -0
  29. package/dist/routes/llms.txt.d.mts +1 -0
  30. package/dist/routes/llms.txt.mjs +60 -12
  31. package/dist/routes/robots.txt.mjs +32 -4
  32. package/dist/routes/rss.xml.d.mts +4 -0
  33. package/dist/routes/rss.xml.mjs +79 -0
  34. package/dist/routes/security.txt.d.mts +5 -0
  35. package/dist/routes/security.txt.mjs +24 -0
  36. package/dist/routes/site.webmanifest.d.mts +5 -0
  37. package/dist/routes/site.webmanifest.mjs +23 -0
  38. package/dist/routes/sitemap.xml.mjs +18 -4
  39. package/dist/rss.d.mts +8 -0
  40. package/dist/rss.mjs +44 -0
  41. package/dist/security.d.mts +7 -0
  42. package/dist/security.mjs +34 -0
  43. package/dist/types.d.mts +263 -3
  44. package/package.json +38 -3
  45. package/src/assets.test.ts +70 -0
  46. package/src/assets.ts +137 -0
  47. package/src/catalog.test.ts +26 -0
  48. package/src/catalog.ts +11 -0
  49. package/src/components/SEOHead.astro +1 -1
  50. package/src/env.d.ts +51 -3
  51. package/src/index.ts +33 -2
  52. package/src/integration.ts +307 -28
  53. package/src/manifest.test.ts +41 -0
  54. package/src/manifest.ts +59 -0
  55. package/src/og.ts +436 -0
  56. package/src/routes/api-catalog.ts +55 -0
  57. package/src/routes/apple-touch-icon.png.ts +19 -0
  58. package/src/routes/favicon.ico.ts +19 -0
  59. package/src/routes/favicon.svg.ts +17 -0
  60. package/src/routes/icon-192.png.ts +19 -0
  61. package/src/routes/icon-512.png.ts +19 -0
  62. package/src/routes/icon-maskable-512.png.ts +24 -0
  63. package/src/routes/llms-full.txt.ts +77 -0
  64. package/src/routes/llms.txt.ts +84 -13
  65. package/src/routes/robots.txt.ts +47 -4
  66. package/src/routes/rss.xml.ts +129 -0
  67. package/src/routes/security.txt.ts +30 -0
  68. package/src/routes/site.webmanifest.ts +28 -0
  69. package/src/routes/sitemap.xml.ts +32 -5
  70. package/src/rss.test.ts +28 -0
  71. package/src/rss.ts +63 -0
  72. package/src/security.test.ts +46 -0
  73. package/src/security.ts +78 -0
  74. package/src/types.ts +286 -3
package/src/types.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import type { LlmsTxtOptions, LlmsFullTxtOptions } from "./llms.js"
2
+
1
3
  /**
2
4
  * Change frequency for sitemap entries
3
5
  */
@@ -121,16 +123,17 @@ export interface SiteConfig {
121
123
  name: string
122
124
  description: string
123
125
  url: string
124
- ogImage: string
126
+ ogImage?: string
125
127
  author: string
126
128
  email: string
127
129
  branding: {
128
130
  logo: {
129
131
  alt: string
130
132
  }
131
- favicon: {
133
+ favicon?: {
132
134
  svg: string
133
135
  }
136
+ icon?: string
134
137
  colors: {
135
138
  themeColor: string
136
139
  backgroundColor: string
@@ -138,7 +141,7 @@ export interface SiteConfig {
138
141
  }
139
142
  seo: {
140
143
  titleTemplate: string
141
- ogImageFallback: string
144
+ ogImageFallback?: string
142
145
  maxDescriptionLength: number
143
146
  authorHandle?: string
144
147
  }
@@ -277,5 +280,285 @@ export interface HeadProps {
277
280
  twitter?: TwitterMeta
278
281
  }
279
282
 
283
+ export interface RssItem {
284
+ title: string
285
+ link: string
286
+ pubDate: Date | string | number
287
+ description?: string
288
+ content?: string
289
+ guid?: string
290
+ author?: string
291
+ }
292
+
293
+ export interface RssFeedOptions {
294
+ title: string
295
+ description: string
296
+ site: string
297
+ feedUrl?: string
298
+ language?: string
299
+ items: RssItem[]
300
+ }
301
+
302
+ export interface RssCollectionConfig {
303
+ name: string
304
+ pathPrefix?: string
305
+ }
306
+
307
+ export interface RssOptions extends Omit<Partial<RssFeedOptions>, "items"> {
308
+ /**
309
+ * Custom RSS route pattern (default: "/rss.xml")
310
+ */
311
+ path?: string
312
+ /**
313
+ * Custom items loader or static items array
314
+ */
315
+ items?: RssItem[] | (() => Promise<RssItem[]> | RssItem[])
316
+ /**
317
+ * Collections to include in RSS feed (defaults to ["blog", "posts", "news", "articles"])
318
+ */
319
+ collections?: (string | RssCollectionConfig)[]
320
+ }
321
+
322
+ export interface SitemapOptions {
323
+ /**
324
+ * Sitemap route pattern (default: "/sitemap.xml")
325
+ */
326
+ path?: string
327
+ urls?: SitemapUrl[]
328
+ entries?: () => Promise<SeoEntry[]> | SeoEntry[]
329
+ locales?: LocaleConfig
330
+ [key: string]: unknown
331
+ }
332
+
333
+ export interface SecurityTxtOptions {
334
+ /**
335
+ * Contact URI or list of contact URIs (e.g. "mailto:security@example.com") - REQUIRED by RFC 9116
336
+ */
337
+ contact: string | string[]
338
+ /**
339
+ * Expiration date/time (ISO 8601 string or Date) - REQUIRED by RFC 9116
340
+ */
341
+ expires?: Date | string
342
+ /**
343
+ * URI to PGP/GPG public key
344
+ */
345
+ encryption?: string | string[]
346
+ /**
347
+ * URI to security acknowledgments / hall of fame
348
+ */
349
+ acknowledgments?: string | string[]
350
+ /**
351
+ * Comma-separated list of preferred languages (e.g. "en, pt")
352
+ */
353
+ preferredLanguages?: string
354
+ /**
355
+ * Canonical URI of the security.txt file
356
+ */
357
+ canonical?: string
358
+ /**
359
+ * URI to security policy
360
+ */
361
+ policy?: string
362
+ /**
363
+ * URI to security hiring page
364
+ */
365
+ hiring?: string
366
+ /**
367
+ * URI to Common Security Advisory Framework (CSAF) provider
368
+ */
369
+ csaf?: string
370
+ }
371
+
372
+ export interface SecurityRouteOptions extends Partial<SecurityTxtOptions> {
373
+ /**
374
+ * Route pattern (default: "/.well-known/security.txt")
375
+ */
376
+ path?: string
377
+ /**
378
+ * Whether to also inject legacy fallback route at "/security.txt" (default: true)
379
+ */
380
+ legacyRoute?: boolean
381
+ }
382
+
383
+ export interface WebManifestIcon {
384
+ src: string
385
+ sizes: string
386
+ type: string
387
+ purpose?: "any" | "maskable" | "monochrome"
388
+ }
389
+
390
+ export interface WebManifestShortcut {
391
+ name: string
392
+ url: string
393
+ short_name?: string
394
+ description?: string
395
+ icons?: WebManifestIcon[]
396
+ }
397
+
398
+ export interface WebManifest {
399
+ name: string
400
+ short_name?: string
401
+ description?: string
402
+ start_url: string
403
+ display: "fullscreen" | "standalone" | "minimal-ui" | "browser"
404
+ background_color: string
405
+ theme_color: string
406
+ icons: WebManifestIcon[]
407
+ shortcuts?: WebManifestShortcut[]
408
+ categories?: string[]
409
+ lang?: string
410
+ dir?: "auto" | "ltr" | "rtl"
411
+ orientation?: "any" | "natural" | "landscape" | "portrait"
412
+ scope?: string
413
+ [key: string]: unknown
414
+ }
415
+
416
+ export interface WebManifestOptions {
417
+ name: string
418
+ shortName?: string
419
+ description?: string
420
+ startUrl?: string
421
+ display?: "fullscreen" | "standalone" | "minimal-ui" | "browser"
422
+ backgroundColor?: string
423
+ themeColor?: string
424
+ icons?: WebManifestIcon[]
425
+ shortcuts?: WebManifestShortcut[]
426
+ categories?: string[]
427
+ lang?: string
428
+ dir?: "auto" | "ltr" | "rtl"
429
+ orientation?: "any" | "natural" | "landscape" | "portrait"
430
+ scope?: string
431
+ }
432
+
433
+ export interface ManifestRouteOptions extends Partial<WebManifestOptions> {
434
+ /**
435
+ * Route pattern (default: "/site.webmanifest")
436
+ */
437
+ path?: string
438
+ }
439
+
440
+ export interface ApiCatalogItem {
441
+ rel: string
442
+ href: string
443
+ type?: string
444
+ title?: string
445
+ [key: string]: unknown
446
+ }
447
+
448
+ export interface ApiCatalog {
449
+ "api-catalog": ApiCatalogItem[]
450
+ }
451
+
452
+ export interface ApiCatalogOptions {
453
+ items: ApiCatalogItem[]
454
+ }
455
+
456
+ export interface ApiCatalogRouteOptions extends Partial<ApiCatalogOptions> {
457
+ /**
458
+ * Route pattern (default: "/.well-known/api-catalog")
459
+ */
460
+ path?: string
461
+ }
462
+
463
+ export interface RobotsRouteOptions extends Partial<RobotsOptions> {
464
+ /**
465
+ * Route pattern (default: "/robots.txt")
466
+ */
467
+ path?: string
468
+ }
469
+
470
+ export interface LlmsRouteOptions extends Partial<LlmsTxtOptions> {
471
+ /**
472
+ * Route pattern (default: "/llms.txt")
473
+ */
474
+ path?: string
475
+ }
476
+
477
+ export interface LlmsFullRouteOptions extends Partial<LlmsFullTxtOptions> {
478
+ /**
479
+ * Route pattern (default: "/llms-full.txt")
480
+ */
481
+ path?: string
482
+ }
483
+
484
+ export interface AssetRouteOptions {
485
+ /**
486
+ * Path to the master SVG/PNG icon file (relative to project root or absolute). If omitted, will
487
+ * search in src/assets/logos/ or siteConfig.branding.icon.
488
+ */
489
+ icon?: string
490
+ /**
491
+ * Background color for maskable icons (defaults to siteConfig.branding.colors.backgroundColor or
492
+ * #ffffff)
493
+ */
494
+ backgroundColor?: string
495
+ /**
496
+ * Whether to inject /favicon.ico (default: true)
497
+ */
498
+ faviconIco?: boolean
499
+ /**
500
+ * Whether to inject /apple-touch-icon.png (default: true)
501
+ */
502
+ appleTouchIcon?: boolean
503
+ /**
504
+ * Whether to inject /icon-192.png (default: true)
505
+ */
506
+ icon192?: boolean
507
+ /**
508
+ * Whether to inject /icon-512.png (default: true)
509
+ */
510
+ icon512?: boolean
511
+ /**
512
+ * Whether to inject /icon-maskable-512.png (default: true)
513
+ */
514
+ iconMaskable?: boolean
515
+ /**
516
+ * Whether to generate and emit /og.png branded card (default: true)
517
+ */
518
+ ogImage?: boolean
519
+ }
520
+
521
+ export interface RimelightSeoOptions {
522
+ /**
523
+ * Sitemap configuration or false to disable automatic /sitemap.xml (default: true)
524
+ */
525
+ sitemap?: boolean | SitemapOptions
526
+ /**
527
+ * Robots.txt configuration or false to disable automatic /robots.txt (default: true)
528
+ */
529
+ robots?: boolean | RobotsRouteOptions
530
+ /**
531
+ * RSS feed configuration or false to disable automatic /rss.xml (default: true)
532
+ */
533
+ rss?: boolean | RssOptions
534
+ /**
535
+ * LLMs.txt configuration or false to disable automatic /llms.txt (default: true)
536
+ */
537
+ llms?: boolean | LlmsRouteOptions
538
+ /**
539
+ * LLMs-full.txt configuration or false to disable automatic /llms-full.txt (default: true)
540
+ */
541
+ llmsFull?: boolean | LlmsFullRouteOptions
542
+ /**
543
+ * Security.txt configuration or false to disable automatic /.well-known/security.txt (default:
544
+ * true)
545
+ */
546
+ security?: boolean | SecurityRouteOptions
547
+ /**
548
+ * RFC 9652 API Catalog configuration or false to disable automatic /.well-known/api-catalog
549
+ * (default: true)
550
+ */
551
+ apiCatalog?: boolean | ApiCatalogRouteOptions
552
+ /**
553
+ * Web App Manifest configuration or false to disable automatic /site.webmanifest (default: true)
554
+ */
555
+ manifest?: boolean | ManifestRouteOptions
556
+ /**
557
+ * Automatic generation of compliant public image assets (favicon.ico, apple-touch-icon.png, PWA
558
+ * icons) from a single master icon (default: true)
559
+ */
560
+ assets?: boolean | AssetRouteOptions
561
+ }
562
+
280
563
  export type { LlmsPage, LlmsTxtOptions, LlmsFullTxtOptions } from "./llms.js"
281
564
  export type { ArticleSchemaOptions, BreadcrumbItem } from "./schema.js"