@softure-ai/blog 0.1.8 → 0.1.10

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 (97) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.md +34 -0
  3. package/dist/index.d.ts +21 -0
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +1 -1
  6. package/dist/index.js.map +1 -1
  7. package/dist/messages/en.d.ts +2 -0
  8. package/dist/messages/en.d.ts.map +1 -1
  9. package/dist/messages/en.js +2 -0
  10. package/dist/messages/en.js.map +1 -1
  11. package/dist/messages/index.d.ts +2 -0
  12. package/dist/messages/index.d.ts.map +1 -1
  13. package/dist/messages/pl.d.ts +2 -0
  14. package/dist/messages/pl.d.ts.map +1 -1
  15. package/dist/messages/pl.js +2 -0
  16. package/dist/messages/pl.js.map +1 -1
  17. package/dist/next/body.d.ts +16 -0
  18. package/dist/next/body.d.ts.map +1 -0
  19. package/dist/next/body.js +22 -0
  20. package/dist/next/body.js.map +1 -0
  21. package/dist/next/context.d.ts.map +1 -1
  22. package/dist/next/context.js +1 -0
  23. package/dist/next/context.js.map +1 -1
  24. package/dist/next/discovery.js +2 -2
  25. package/dist/next/discovery.js.map +1 -1
  26. package/dist/next/index.d.ts +1 -0
  27. package/dist/next/index.d.ts.map +1 -1
  28. package/dist/next/index.js +1 -0
  29. package/dist/next/index.js.map +1 -1
  30. package/dist/next/json-ld.d.ts.map +1 -1
  31. package/dist/next/json-ld.js +11 -3
  32. package/dist/next/json-ld.js.map +1 -1
  33. package/dist/next/metadata.d.ts +1 -1
  34. package/dist/next/metadata.d.ts.map +1 -1
  35. package/dist/next/metadata.js +8 -6
  36. package/dist/next/metadata.js.map +1 -1
  37. package/dist/next/pages.d.ts.map +1 -1
  38. package/dist/next/pages.js +6 -11
  39. package/dist/next/pages.js.map +1 -1
  40. package/dist/options.d.ts +30 -0
  41. package/dist/options.d.ts.map +1 -1
  42. package/dist/options.js +35 -0
  43. package/dist/options.js.map +1 -1
  44. package/dist/pages/dates.d.ts +2 -2
  45. package/dist/pages/dates.d.ts.map +1 -1
  46. package/dist/pages/dates.js +5 -3
  47. package/dist/pages/dates.js.map +1 -1
  48. package/dist/pages/index.d.ts +2 -2
  49. package/dist/pages/index.d.ts.map +1 -1
  50. package/dist/pages/index.js +2 -2
  51. package/dist/pages/index.js.map +1 -1
  52. package/dist/pages/json-ld.d.ts +11 -0
  53. package/dist/pages/json-ld.d.ts.map +1 -1
  54. package/dist/pages/json-ld.js +14 -7
  55. package/dist/pages/json-ld.js.map +1 -1
  56. package/dist/pages/listing.d.ts +9 -3
  57. package/dist/pages/listing.d.ts.map +1 -1
  58. package/dist/pages/listing.js +7 -5
  59. package/dist/pages/listing.js.map +1 -1
  60. package/dist/quality/settings.d.ts +2 -2
  61. package/dist/quality/settings.d.ts.map +1 -1
  62. package/dist/quality/settings.js +5 -2
  63. package/dist/quality/settings.js.map +1 -1
  64. package/dist/server/index.d.ts +1 -1
  65. package/dist/server/index.d.ts.map +1 -1
  66. package/dist/server/index.js +1 -1
  67. package/dist/server/index.js.map +1 -1
  68. package/dist/server/options.d.ts +9 -1
  69. package/dist/server/options.d.ts.map +1 -1
  70. package/dist/server/options.js +6 -0
  71. package/dist/server/options.js.map +1 -1
  72. package/dist/ui/blog-listing.js +2 -2
  73. package/dist/ui/blog-listing.js.map +1 -1
  74. package/dist/ui/page-context.d.ts +2 -0
  75. package/dist/ui/page-context.d.ts.map +1 -1
  76. package/module.json +1 -1
  77. package/package.json +2 -2
  78. package/src/index.ts +1 -1
  79. package/src/messages/en.ts +2 -0
  80. package/src/messages/pl.ts +2 -0
  81. package/src/next/body.ts +33 -0
  82. package/src/next/context.ts +1 -0
  83. package/src/next/discovery.ts +2 -2
  84. package/src/next/index.ts +1 -0
  85. package/src/next/json-ld.ts +11 -3
  86. package/src/next/metadata.ts +9 -7
  87. package/src/next/pages.tsx +7 -14
  88. package/src/options.ts +42 -0
  89. package/src/pages/dates.ts +3 -4
  90. package/src/pages/index.ts +3 -1
  91. package/src/pages/json-ld.ts +29 -8
  92. package/src/pages/listing.ts +18 -5
  93. package/src/quality/settings.ts +3 -3
  94. package/src/server/index.ts +1 -1
  95. package/src/server/options.ts +14 -1
  96. package/src/ui/blog-listing.tsx +2 -2
  97. package/src/ui/page-context.ts +2 -0
@@ -1,7 +1,7 @@
1
1
  // The blog options, routes and copy of the running app, read from the configuration.
2
2
  import { getModule, getSiteUrls, type AnySoftureModule, type SoftureConfig } from "@softure-ai/core";
3
3
  import type { BlogMessages } from "../messages/index.js";
4
- import type { BlogOptions } from "../options.js";
4
+ import { DEFAULT_OPEN_GRAPH_LOCALES, type BlogOptions } from "../options.js";
5
5
  import { getReservedSlugs, normalizeRoute, type BlogRoutes } from "../pages/paths.js";
6
6
  import { resolveQualitySettings, type QualitySettings } from "../quality/settings.js";
7
7
 
@@ -39,6 +39,19 @@ export function getBlogRoutes(config: SoftureConfig): BlogRoutes {
39
39
  return { index: read("index"), glossary: read("glossary"), method: read("method"), rss: read("rss") };
40
40
  }
41
41
 
42
+ export interface BlogLocaleTags {
43
+ /** BCP-47: JSON-LD `inLanguage` and the feed's `<language>`. */
44
+ readonly bcp47: string;
45
+ /** `og:locale`, `language_TERRITORY`. */
46
+ readonly openGraph: string;
47
+ }
48
+
49
+ /** The app locale's language tags: the app's `locales` entry, else the bare code and `en_US` / `pl_PL`. */
50
+ export function getBlogLocaleTags(config: SoftureConfig): BlogLocaleTags {
51
+ const tags = getBlogOptions(config).locales[config.locale];
52
+ return { bcp47: tags?.bcp47 ?? config.locale, openGraph: tags?.openGraph ?? DEFAULT_OPEN_GRAPH_LOCALES[config.locale] };
53
+ }
54
+
42
55
  /** The path of the cache refresh route (`refreshBlogCache`), outside the pages' routes. */
43
56
  export function getBlogRefreshPath(config: SoftureConfig): string {
44
57
  const path = getBlogModule(config).routes.refresh;
@@ -59,8 +59,8 @@ export function BlogListingView({ context, groups, termCount, timezone, cta }: B
59
59
  ) : (
60
60
  <div className="blog-groups">
61
61
  {groups.map((group) => {
62
- const id = group.cluster === null ? undefined : getClusterAnchor(group.cluster);
63
- const headingId = `${id ?? "cluster-other"}-heading`;
62
+ const id = group.cluster === null ? undefined : getClusterAnchor(group.cluster, context.clusterAnchorPrefix);
63
+ const headingId = `${id ?? getClusterAnchor("other", context.clusterAnchorPrefix)}-heading`;
64
64
  return (
65
65
  <section key={group.cluster ?? ""} id={id} aria-labelledby={headingId} className="blog-group">
66
66
  <h2 id={headingId} className="blog-group-title">
@@ -14,4 +14,6 @@ export interface BlogPageContext {
14
14
  readonly brand: string | null;
15
15
  /** The note under every text in the locale; `null` without one. */
16
16
  readonly disclaimer: string | null;
17
+ /** The listing's cluster anchor prefix (`<prefix>-<cluster>`); `cluster` when left out. */
18
+ readonly clusterAnchorPrefix?: string;
17
19
  }