@growth-labs/seo 0.2.3 → 0.2.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@growth-labs/seo",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -3,8 +3,12 @@
3
3
  // Required so `getConfig()` works in the Cloudflare prerender Worker.
4
4
  import 'virtual:growth-labs/seo/config'
5
5
 
6
- import { resolveAeoTwins } from '../options.js'
7
- import { getConfig } from '../state.js'
6
+ // Use package self-imports (not relative ../options.js / ../state.js) because
7
+ // this component ships as source from src/components/ but options.ts and state.ts
8
+ // compile to dist/. Relative `../options.js` would resolve to the non-existent
9
+ // src/options.js inside the consumer's node_modules. Package specifiers route
10
+ // through the exports map to the compiled dist output.
11
+ import { getConfig, resolveAeoTwins } from '@growth-labs/seo'
8
12
 
9
13
  export interface Props {
10
14
  /**
@@ -13,9 +17,21 @@ export interface Props {
13
17
  * differs from the request URL (e.g. canonicalizing away trailing slash).
14
18
  */
15
19
  canonical?: URL | string
20
+
21
+ /**
22
+ * Emit the `<link rel="alternate" type="text/markdown">` pointer for the
23
+ * current page. Defaults to `true`, matching 0.2.3/0.2.4 behavior.
24
+ *
25
+ * Pass `false` on routes where no `.md` twin exists (homepage, tag
26
+ * indexes, landing pages, search) to avoid a link that 404s. Suppressing
27
+ * the twin link here does NOT suppress other head tags — Apple News
28
+ * discovery still emits, centralized in one place rather than wrapping
29
+ * the whole `<AeoHead />` in a conditional.
30
+ */
31
+ emitTwinLink?: boolean
16
32
  }
17
33
 
18
- const { canonical } = Astro.props
34
+ const { canonical, emitTwinLink = true } = Astro.props
19
35
  const config = getConfig()
20
36
  const aeo = resolveAeoTwins(config.aeoTwins)
21
37
 
@@ -42,7 +58,7 @@ function defaultTwinUrl(url: string): string {
42
58
  }
43
59
 
44
60
  const twinHref =
45
- aeo && aeo.mode !== 'middleware'
61
+ emitTwinLink && aeo && aeo.mode !== 'middleware'
46
62
  ? (aeo.twinUrl ?? defaultTwinUrl)(pageUrl)
47
63
  : null
48
64
  ---