Skip to content

Commit 7452fc6

Browse files
committed
Removes special Astro handling instructions
1 parent e845faf commit 7452fc6

File tree

1 file changed

+0
-53
lines changed

1 file changed

+0
-53
lines changed

README.md

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -127,59 +127,6 @@ export default {
127127

128128
**Campaign Pages**: Enable marketing campaigns to link directly to specific product features or testimonials.
129129

130-
## Usage with Astro (Headless)
131-
132-
> **⚠️ Current Limitation**: The configuration options described above (like `anchorAttribute`, `anchors: false`, and `anchorDefault`) are not currently passed through to headless frontends like Astro. These options only work in traditional ApostropheCMS projects. We're working on improving this integration.
133-
134-
When using ApostropheCMS as a headless CMS with an Astro frontend, you can still implement anchor functionality by manually handling the anchor data in your Astro components. You can also pass options to individual widgets on a per-area basis, but you will have to alter the code examples below to handle these options.
135-
136-
### Step 1: Create the WidgetWrapper Component
137-
138-
In your Astro frontend, create `components/WidgetWrapper.astro` with the following content:
139-
140-
```javascript
141-
---
142-
const { widget } = Astro.props;
143-
144-
const hasAnchor = widget?.anchorId;
145-
---
146-
147-
{
148-
hasAnchor ? (
149-
<div id={widget.anchorId}>
150-
<slot />
151-
</div>
152-
) : (
153-
<slot />
154-
)
155-
}
156-
```
157-
158-
### Step 2: Wrap Your Widget Components
159-
160-
Then go to your widget components (e.g., `widgets/ImageWidget.astro`) and wrap their existing content with the WidgetWrapper:
161-
162-
```javascript
163-
// Before
164-
---
165-
<Figure {image} {link} caption={widget.caption} {style} />
166-
```
167-
168-
```javascript
169-
// After
170-
---
171-
import WidgetWrapper from '../components/WidgetWrapper.astro';
172-
---
173-
<WidgetWrapper {widget}>
174-
<Figure {image} {link} caption={widget.caption} {style} />
175-
</WidgetWrapper>
176-
```
177-
178-
**Benefits of this approach:**
179-
- No overhead when widgets don't contain anchor data (no artificial wrappers)
180-
- You can add additional project-specific functionality and options to `WidgetWrapper.astro`
181-
- Minimizes boilerplate code and provides a single source of truth for common widget logic
182-
183130
### Getting Started with Astro + ApostropheCMS
184131

185132
New to using ApostropheCMS with Astro? Check out our starter kits:

0 commit comments

Comments
 (0)