@sarimarcus/content-sites-tourism 0.34.0 → 0.34.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.
- package/CHANGELOG.md +4 -0
- package/package.json +3 -3
- package/src/templates/DetailBody.astro +38 -9
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
All packages in the platform release in lockstep; entries are per release version.
|
|
4
4
|
|
|
5
|
+
## 0.34.1 (2026-10-12)
|
|
6
|
+
|
|
7
|
+
- `DetailBody` takes `as`, `anchored`, `pagefind` and `transformHtml` props and an `interludes` slot, so Córdoba's and Granada's entity bodies adopt it (SLA-3043). Additive. The root's class order is now `<prose> max-w-none <class> scroll-mt-28`; no site renders 0.33.0's `DetailBody`.
|
|
8
|
+
|
|
5
9
|
## 0.34.0 (2026-10-12)
|
|
6
10
|
|
|
7
11
|
- `MonumentHero` and `QuartierHero` join `@sarimarcus/content-sites-tourism/sections` (SLA-3041), built on ui `ContentHero`. The site adapter resolves the optimized image, the placeholder, the copy and the directions link, and passes them as props.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sarimarcus/content-sites-tourism",
|
|
3
|
-
"version": "0.34.
|
|
3
|
+
"version": "0.34.1",
|
|
4
4
|
"description": "City-tourism vertical: city-entity components, pages templates and utilities for the tourism sites.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"astro": "^7.0.6",
|
|
37
37
|
"tailwindcss": "^4.1.18",
|
|
38
|
-
"@sarimarcus/content-sites-core": "0.34.
|
|
39
|
-
"@sarimarcus/content-sites-ui": "0.34.
|
|
38
|
+
"@sarimarcus/content-sites-core": "0.34.1",
|
|
39
|
+
"@sarimarcus/content-sites-ui": "0.34.1"
|
|
40
40
|
}
|
|
41
41
|
}
|
|
@@ -2,8 +2,12 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Entity detail body: the `longDescription` lede plus one anchored `<section>`
|
|
4
4
|
* per H2, so the ToC (`bodyTocItems`) and the markup come from one array. Without
|
|
5
|
-
* a `longDescription` it renders the
|
|
5
|
+
* a `longDescription` it renders the default slot, or `description` as a
|
|
6
6
|
* paragraph in the `#description` anchor.
|
|
7
|
+
*
|
|
8
|
+
* `anchored={false}` drops the `#description` anchor, its scroll offset and the
|
|
9
|
+
* fallback, for pages whose ToC targets come from a wrapper around this body.
|
|
10
|
+
* The `interludes` slot renders between the lede and the first section.
|
|
7
11
|
*/
|
|
8
12
|
import type { DetailBodyContent } from './detailBody.ts';
|
|
9
13
|
|
|
@@ -14,6 +18,11 @@ interface Props {
|
|
|
14
18
|
description?: string;
|
|
15
19
|
proseClass?: string;
|
|
16
20
|
class?: string;
|
|
21
|
+
as?: 'article' | 'div';
|
|
22
|
+
anchored?: boolean;
|
|
23
|
+
pagefind?: boolean;
|
|
24
|
+
/** Maps each rendered HTML fragment (lede and sections), e.g. to tag affiliate links. */
|
|
25
|
+
transformHtml?: (html: string) => string;
|
|
17
26
|
}
|
|
18
27
|
|
|
19
28
|
const {
|
|
@@ -22,27 +31,47 @@ const {
|
|
|
22
31
|
description,
|
|
23
32
|
proseClass = 'prose prose-lg',
|
|
24
33
|
class: className = 'mb-6',
|
|
34
|
+
as: root = 'article',
|
|
35
|
+
anchored = true,
|
|
36
|
+
pagefind = true,
|
|
37
|
+
transformHtml = (html: string) => html,
|
|
25
38
|
} = Astro.props;
|
|
26
39
|
|
|
40
|
+
const hasInterludes = Astro.slots.has('interludes');
|
|
27
41
|
const showBody = hasBody && (!!body.lede || body.sections.length > 0);
|
|
28
|
-
// With no H2 the
|
|
29
|
-
const
|
|
42
|
+
// With no H2 the root is the lone ToC target, so it is the scroll-spy section.
|
|
43
|
+
const idAttr = anchored ? { id: 'description' } : {};
|
|
44
|
+
const pagefindAttr = pagefind ? { 'data-pagefind-body': '' } : {};
|
|
45
|
+
const guideAttr = anchored && body.sections.length === 0 ? { 'data-guide-section': '' } : {};
|
|
46
|
+
const rootClass = [proseClass, 'max-w-none', className, anchored && 'scroll-mt-28'];
|
|
30
47
|
---
|
|
31
48
|
|
|
32
49
|
{showBody ? (
|
|
33
|
-
|
|
34
|
-
|
|
50
|
+
root === 'div' ? (
|
|
51
|
+
<div {...idAttr} class:list={rootClass} {...pagefindAttr} {...guideAttr}>
|
|
52
|
+
{body.lede && <Fragment set:html={transformHtml(body.lede)} />}{hasInterludes && <slot name="interludes" />}
|
|
35
53
|
{body.sections.map((s) => (
|
|
36
54
|
<section id={s.id} data-guide-section class="scroll-mt-28">
|
|
37
55
|
<h2 set:html={s.headingHtml} />
|
|
38
|
-
<Fragment set:html={s.html} />
|
|
56
|
+
<Fragment set:html={transformHtml(s.html)} />
|
|
57
|
+
</section>
|
|
58
|
+
))}
|
|
59
|
+
</div>
|
|
60
|
+
) : (
|
|
61
|
+
<article {...idAttr} class:list={rootClass} {...pagefindAttr} {...guideAttr}>
|
|
62
|
+
{body.lede && <Fragment set:html={transformHtml(body.lede)} />}{hasInterludes && <slot name="interludes" />}
|
|
63
|
+
{body.sections.map((s) => (
|
|
64
|
+
<section id={s.id} data-guide-section class="scroll-mt-28">
|
|
65
|
+
<h2 set:html={s.headingHtml} />
|
|
66
|
+
<Fragment set:html={transformHtml(s.html)} />
|
|
39
67
|
</section>
|
|
40
68
|
))}
|
|
41
69
|
</article>
|
|
42
|
-
)
|
|
43
|
-
|
|
70
|
+
)
|
|
71
|
+
) : anchored ? (
|
|
72
|
+
<div id="description" data-guide-section class:list={[className, 'scroll-mt-28']}>
|
|
44
73
|
<slot>
|
|
45
74
|
<p class="text-lg text-foreground leading-relaxed">{description}</p>
|
|
46
75
|
</slot>
|
|
47
76
|
</div>
|
|
48
|
-
)}
|
|
77
|
+
) : null}
|