DoubleShore.Umbraco.HeadlessPreview
1.0.6
dotnet add package DoubleShore.Umbraco.HeadlessPreview --version 1.0.6
NuGet\Install-Package DoubleShore.Umbraco.HeadlessPreview -Version 1.0.6
<PackageReference Include="DoubleShore.Umbraco.HeadlessPreview" Version="1.0.6" />
<PackageVersion Include="DoubleShore.Umbraco.HeadlessPreview" Version="1.0.6" />
<PackageReference Include="DoubleShore.Umbraco.HeadlessPreview" />
paket add DoubleShore.Umbraco.HeadlessPreview --version 1.0.6
#r "nuget: DoubleShore.Umbraco.HeadlessPreview, 1.0.6"
#:package DoubleShore.Umbraco.HeadlessPreview@1.0.6
#addin nuget:?package=DoubleShore.Umbraco.HeadlessPreview&version=1.0.6
#tool nuget:?package=DoubleShore.Umbraco.HeadlessPreview&version=1.0.6
🚀 Umbraco Headless Preview
Instant frontend preview for your headless Umbraco setup
Built with ❤️ by Double Shore - Your trusted Umbraco specialists.
✨ What is this?
DoubleShore.Umbraco.HeadlessPreview seamlessly connects Umbraco's backoffice to your frontend application, enabling content editors to preview unpublished changes in real-time with a single click.
🎯 Perfect for Headless CMS Setups
When you decouple Umbraco from your frontend, you lose the native preview functionality. This package brings it back - better than ever.
🌟 Features
| Feature | Description |
|---|---|
| One-Click Preview | Preview button appears directly in Umbraco's content editor |
| Any Frontend | Works with Next.js, Nuxt, Astro, SvelteKit, Remix, and more |
| Multi-Language | Full support for multilingual content preview with localized labels |
| Draft Mode | Integrates with your frontend's draft/preview mode |
| Localization | Preview label can be localized via Umbraco dictionary |
| Zero Config | Just add your frontend URL - we handle the rest |
| Lightweight | Minimal footprint, maximum performance |
📦 Installation
dotnet add package DoubleShore.Umbraco.HeadlessPreview
Or via NuGet Package Manager:
Install-Package DoubleShore.Umbraco.HeadlessPreview
⚡ Quick Start
1. Configure Umbraco
Add to your appsettings.json:
{
"HeadlessPreview": {
"BaseUrl": "https://your-frontend.com",
"PreviewSecret": "your-super-secret-key",
"PreviewEndpoint": "/api/preview",
"PreviewLabel": "Preview on Frontend",
"UseLocalization": true
}
}
2. Implement Frontend Endpoint
Create a preview API endpoint on your frontend. See examples below for each framework.
3. Preview!
Click "Preview on Frontend" in Umbraco's content editor to see your unpublished changes.
🌍 Localization
To localize the preview label:
- Create a dictionary item in Umbraco with key
HeadlessPreview_Label - Add translations for each language
- Set
PreviewLabelto#HeadlessPreview_Labelin appsettings.json
{
"HeadlessPreview": {
"PreviewLabel": "#HeadlessPreview_Label",
"UseLocalization": true
}
}
🔧 Configuration Options
| Setting | Description | Default |
|---|---|---|
BaseUrl |
Your frontend URL | required |
PreviewSecret |
Shared secret for authentication | required |
PreviewEndpoint |
Path to your preview API | /api/preview |
PreviewLabel |
Button label (or dictionary key with #) | Preview on Frontend |
UseLocalization |
Enable dictionary lookup for label | true |
Enabled |
Enable/disable the package | true |
🖼️ Frontend Examples
Next.js (App Router)
// app/api/preview/route.ts
import { draftMode } from 'next/headers';
import { redirect } from 'next/navigation';
export async function GET(request: Request) {
const { searchParams } = new URL(request.url);
const secret = searchParams.get('secret');
const path = searchParams.get('path');
if (secret !== process.env.PREVIEW_SECRET) {
return new Response('Invalid token', { status: 401 });
}
const draft = await draftMode();
draft.enable();
redirect(path || '/');
}
Nuxt 3
// server/api/preview.ts
export default defineEventHandler(async (event) => {
const query = getQuery(event);
if (query.secret !== process.env.PREVIEW_SECRET) {
throw createError({ statusCode: 401, message: 'Invalid token' });
}
// Enable preview mode via cookie
setCookie(event, 'preview-mode', 'true', { path: '/' });
return sendRedirect(event, query.path as string || '/');
});
Astro
// src/pages/api/preview.ts
import type { APIRoute } from 'astro';
export const GET: APIRoute = async ({ request, cookies, redirect }) => {
const url = new URL(request.url);
const secret = url.searchParams.get('secret');
const path = url.searchParams.get('path');
if (secret !== import.meta.env.PREVIEW_SECRET) {
return new Response('Invalid token', { status: 401 });
}
cookies.set('preview-mode', 'true', { path: '/' });
return redirect(path || '/');
};
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🏢 About Double Shore
Double Shore is a digital consultancy specializing in Umbraco development, headless CMS architectures, and modern web solutions.
Our Services
- 🔧 Umbraco Development - Custom implementations and migrations
- 🚀 Headless CMS - Decoupled architectures with modern frontends
- 📈 Performance Optimization - Making your sites blazing fast
- 🎓 Training & Consulting - Upskill your team
Get in Touch
- 🌐 Website: double-shore.com
- 📧 Email: info@double.pt
- 💼 LinkedIn: Double Design and Development
<p align="center"> <strong>Double Shore</strong> <br> <em>Digital Solutions Built with Clarity</em> </p>
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Umbraco.Cms.Web.Common (>= 17.2.1)
- Umbraco.Cms.Web.Website (>= 17.2.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.6 | 119 | 2/25/2026 |