@autobusal/common 1.6.0 → 1.7.0

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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,12 @@
3
3
  All notable changes to `@autobusal/common` are documented here. This project follows
4
4
  [Keep a Changelog](https://keepachangelog.com/) and [Semantic Versioning](https://semver.org/).
5
5
 
6
+ ## [1.7.0] - 2026-07-30
7
+
8
+ ### Added
9
+
10
+ - **New `JsonLd` component** - renders a schema.org `<script type="application/ld+json">` block from a plain object, with `<` escaped to `\u003c` so a string value containing "</script>" can't break out of the tag. No hoisting needed (unlike Meta's title/meta/link) - Google explicitly supports structured data anywhere in the document, so this renders in place. First consumers: `@autobusal/providers`' `Preload.tsx` (sitewide Organization + WebSite) and `route-view`/magus's `BlogView.tsx` (BusTrip/BreadcrumbList, Article).
11
+
6
12
  ## [1.6.0] - 2026-07-30
7
13
 
8
14
  ### Added
package/JsonLd.tsx ADDED
@@ -0,0 +1,18 @@
1
+ interface Props {
2
+ data: object
3
+ }
4
+
5
+ // Structured data (schema.org via JSON-LD) is explicitly fine anywhere in the
6
+ // document per Google's own guidance - no need to hoist into <head> the way
7
+ // Meta.tsx's title/meta/link tags are. Escaping `<` prevents any string value
8
+ // (an article title, a company name) that happens to contain "</script>"
9
+ // from breaking out of the script tag - `<` is a valid JSON escape that
10
+ // every JSON-LD parser (including Google's) correctly reads back as `<`.
11
+ const JsonLd = ({ data }: Props): JSX.Element => (
12
+ <script
13
+ type="application/ld+json"
14
+ dangerouslySetInnerHTML={{ __html: JSON.stringify(data).replace(/</g, '\\u003c') }}
15
+ />
16
+ );
17
+
18
+ export default JsonLd;
package/index.ts CHANGED
@@ -17,6 +17,7 @@ import File from './File/File';
17
17
  import Gender from './Gender';
18
18
  import { General, Inline, Box, BoxMiddle, GeneralFull } from './Loading/Loading';
19
19
  import IpLogs from './IpLogs/IpLogs';
20
+ import JsonLd from './JsonLd';
20
21
  import Meta from './Meta';
21
22
  import Modal from './Modal/Modal';
22
23
  import NotificationIcon from './Notifications/Icon';
@@ -56,6 +57,7 @@ export {
56
57
  GeneralFull,
57
58
  Inline,
58
59
  IpLogs,
60
+ JsonLd,
59
61
  Meta,
60
62
  Modal,
61
63
  NotificationIcon,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autobusal/common",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
4
4
  "author": "Ferjolt Ozuni",
5
5
  "type": "module",
6
6
  "main": "index.ts"