Preview URL for schemas feature clarification


#1

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:

  1. Update Squidex Client library (had an old one)
  2. 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);
  3. 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.
  4. 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


#2

Thank you for the feedback. Documentation is a big topic for me.

  1. Sorry
  2. Yes, good point, it is not mentioned in the docs.

I will have a look but your approach looks okay to me. Do you have unpublished content for this item?


#3

Awesome, thanks Sebastian. Yes, the content that I tested this with is unpublished. Seems to be working fine. Please give a shout if you need more feedback on the docs.


#4

It is working fine? Now I am confused :smiley:


#5

Oh, btw: There is another property called DataDraft that contains the unpublished version of the content. There is a pull request for that (https://github.com/Squidex/squidex-samples/pull/22/files#diff-f601af730d122a5aec87954740086362). But I am waiting for changes.

Btw: Pull requests for the docs are even better than feedback :wink:


#6

Yes, all is working fine. Most stable squidex version so far for me btw.

Got no time for dox pr atm unfortunately. :pensive: