@xexr/blog-platform 1.1.0 → 1.1.1

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.
@@ -98,6 +98,7 @@ function toRow(article: PublishedArticle): ArticleRow {
98
98
  metaJson: JSON.stringify({
99
99
  ...article.meta,
100
100
  __bloggyTopics: article.topics ?? [],
101
+ __bloggyCta: article.cta ?? null,
101
102
  }),
102
103
  version: article.version,
103
104
  };
@@ -123,24 +124,36 @@ function fromRow(row: ArticleRow): PublishedArticle {
123
124
  ? (JSON.parse(row.authorJson) as PublishedAuthor)
124
125
  : null,
125
126
  site: JSON.parse(row.siteJson) as PublishedSite,
127
+ cta: extractCta(row.metaJson),
126
128
  topics: extractTopics(row.metaJson),
127
129
  meta: extractMeta(row.metaJson),
128
130
  version: row.version,
129
131
  };
130
132
  }
131
133
 
134
+ type StoredArticleMeta = PublishedArticle["meta"] & {
135
+ __bloggyTopics?: PublishedArticle["topics"];
136
+ __bloggyCta?: PublishedArticle["cta"] | null;
137
+ };
138
+
139
+ function parseStoredMeta(metaJson: string): StoredArticleMeta {
140
+ return JSON.parse(metaJson) as StoredArticleMeta;
141
+ }
142
+
132
143
  function extractTopics(metaJson: string): PublishedArticle["topics"] {
133
- const parsed = JSON.parse(metaJson) as PublishedArticle["meta"] & {
134
- __bloggyTopics?: PublishedArticle["topics"];
135
- };
144
+ const parsed = parseStoredMeta(metaJson);
136
145
  return parsed.__bloggyTopics ?? [];
137
146
  }
138
147
 
148
+ function extractCta(metaJson: string): PublishedArticle["cta"] {
149
+ const parsed = parseStoredMeta(metaJson);
150
+ return parsed.__bloggyCta ?? undefined;
151
+ }
152
+
139
153
  function extractMeta(metaJson: string): PublishedArticle["meta"] {
140
- const parsed = JSON.parse(metaJson) as PublishedArticle["meta"] & {
141
- __bloggyTopics?: PublishedArticle["topics"];
142
- };
154
+ const parsed = parseStoredMeta(metaJson);
143
155
  delete parsed.__bloggyTopics;
156
+ delete parsed.__bloggyCta;
144
157
  const meta = parsed;
145
158
  return meta;
146
159
  }
@@ -522,7 +522,12 @@ export function validateStructuredData(schema: BaseStructuredData): {
522
522
  export function structuredDataToJsonLd(
523
523
  schema: BaseStructuredData | BaseStructuredData[],
524
524
  ): string {
525
- return JSON.stringify(schema, null, 0);
525
+ return JSON.stringify(schema, null, 0)
526
+ .replace(/</g, "\\u003c")
527
+ .replace(/>/g, "\\u003e")
528
+ .replace(/&/g, "\\u0026")
529
+ .replace(/\u2028/g, "\\u2028")
530
+ .replace(/\u2029/g, "\\u2029");
526
531
  }
527
532
 
528
533
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xexr/blog-platform",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "SEO-friendly blog platform for Next.js 15 with Bloggy integration",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",