Hi,
Wanted to try the “preview URL for schemas” feature today (awesome that this has been implemented by the way) https://support.squidex.io/t/implemented-preview-url-for-schemas/353 … got it to work (I think) but not sure I’ve configured it correctly.
This is what I did:
- Update Squidex Client library (had an old one)
- Added relevant code from “Step 1: Query unpublished content in your application” from https://docs.squidex.io/guides/09-preview to my consuming application
My Get method signature:
public async Task<IActionResult> OnGet(string slug, bool preview = false)
var context = QueryContext.Default.Unpublished(preview);
var posts = await client.GetAsync(filter: $"data/slug/iv eq '{slug}'", context: context);
- Fixed this line:
var posts = await client.GetAsync(filter: $"data/slug/iv eq '{slug}'", context: context);
VS wouldn’t compile because of a syntax error -context:
was missing. - Modded my schema; added the following preview URL:
Localhost
https://localhost:12345/${data.slug}?preview=true
Notice I appended the URL with?preview=true
. This part is not in the docs. Is it needed? I guess so.
So this is my config / steps that I did to be able to preview unpublished content. Am I doing it right?
Also, just some feedback regarding the docs on https://docs.squidex.io/guides/09-preview
I think that it needs a little more work. Maybe a more detailed step by step. And maybe add some references to the repo too; such as https://github.com/Squidex/squidex/blob/d02a2b6b3c71940b350489b48948d443b91b2ea0/src/Squidex/Areas/Api/Controllers/Contents/ContentsController.cs. And also maybe add a link to this thread https://support.squidex.io/t/implemented-preview-url-for-schemas/353