Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Gianni 7 posts 77 karma points
    22 days ago
    Gianni
    0

    "Save and preview" shows only published content

    Hi there, I'm having an issue with the "Save and preview" feature. As the documentation says:

    The Save and preview button allows you to save your changes and preview it before publishing the changes to the live site. The Preview feature shows you how the page will look once it is published. This Save and preview feature only saves your page and does not publish your contents to the live site.

    I'm trying to add a simple text "ABC" inside a RTE of my page's grid content and I expect to see it when I click on "Save and preview" button, but no. Until I publish the content I'm not able to see this "ABC" text on preview page.

    Am I missing something? Maybe could be a wrong configuration?

    Thanks in advantage.

  • Alex Skrypnyk 6048 posts 23038 karma points MVP 5x admin c-trib
    15 days ago
    Alex Skrypnyk
    0

    Hi Gianni

    Can you check the template code? Maybe there is some kind of caching so the content is not showing.

    Preview uses the template to render the content

    Thanks, Alex

  • Gianni 7 posts 77 karma points
    1 week ago
    Gianni
    0

    Thanks Alex, as you can see the template is quite simple:

    @inherits Umbraco.Web.Mvc.UmbracoViewPage<ContentModels.Article>
    @using ContentModels = Umbraco.Web.PublishedModels;
    @{
        Layout = "Master.cshtml";
    }
    
    @functions {
        public static bool UserCanViewPage(bool memberIsSpecialist, bool pageIsForSpecialists)
        {
            return (!pageIsForSpecialists || (memberIsSpecialist && pageIsForSpecialists));
        }
    }
    
    @{
        bool memberIsSpecialist = false;
        bool userCanViewThisPage = true;
    
        var currentMember = Members.GetCurrentMember();
        if (currentMember != null) {
            memberIsSpecialist = (bool)currentMember.GetProperty("memberIsSpecialist").Value();
            userCanViewThisPage = UserCanViewPage(memberIsSpecialist, Model.PageIsForSpecialists);
        }
    }
    
    @if (userCanViewThisPage)
    {
        <div class="container">
    
            <div class="border-bottom d-flex justify-content-between">
                <h1>@Model.PageTitle</h1>
            </div>
    
            @if (!String.IsNullOrEmpty(Model.PageDescription)) 
            {
                <p class="text-mini pt-2">@Model.PageDescription</p>
            }
    
            @Html.GetGridHtml(Model, "pageContent")
        </div>
    }
    else 
    {
        @Html.Partial("NotAuthorized")
    }
    

    This template has only this peculiarity: to show the page the member must be logged and have a "true" flag for IsSpecialist property. Apart this, it shows values from Model (title, content and description), nothing so advanced.

    And no, there isn't cache in the Master template.

    The SignalR hub is working, the page is refreshing every time I made a modify from Umbraco panel, but the content is always the same :(

  • Joe Harvey 4 posts 74 karma points
    7 days ago
    Joe Harvey
    0

    I am also seeing this on an Umbraco 8.11.1 install (a live client site) where everything seems to work as expected with the 'save and publish' button, except that it seems to just show the published version of the page.

    In my case, I am updating content in a 'pageTitle' (textstring editor) and 'content' (RTE editor) in the back-office, then clicking 'save and preview'. I get a new tab, URL of '/umbraco/preview/?id=[mypageid]' with the preview mode bar at the botto, but none of my recent changes shown (same is true if I manually 'Save' first, then 'save and preview'.

    I have various caching methods set up on this site, including things stored in runtime cache and the use of cached partials, but having reviewed my fairly simple template hierarchy for this basic content page (Master.cshtml > General.cshtml, with an @RenderBody() call) I can see no caching in play for these two simple properties on my content page.

    Any ideas how ton try and debug what is going on further?

  • Gianni 7 posts 77 karma points
    6 days ago
    Gianni
    0

    Exactly, Joe.

    And still I don't understand why it happened. Still investigating the issue.

  • Gianni 7 posts 77 karma points
    5 days ago
    Gianni
    0

    I finally discover the reason of my issue. In that installation of Umbraco I have a custom IdentityProvider (using Umbraco.Identity package).

    I found out that removing the custom identity at startup, the site started to preview my contents correctly.

    This solve my issue:

    app
                .UseUmbracoBackOfficeCookieAuthentication(UmbracoContextAccessor, RuntimeState, Services.UserService, GlobalSettings, UmbracoSettings.Security, PipelineStage.Authenticate)
                .UseUmbracoBackOfficeExternalCookieAuthentication(UmbracoContextAccessor, RuntimeState, GlobalSettings, PipelineStage.Authenticate)
                // TODO: this would be considered a breaking change but this must come after all authentication so should be moved within ConfigureMiddleware
                .UseUmbracoPreviewAuthentication(UmbracoContextAccessor, RuntimeState, GlobalSettings, UmbracoSettings.Security, PipelineStage.Authorize);
    

    Found this solution here:

    https://our.umbraco.com/forum/using-umbraco-and-getting-started/103456-page-preview-broken-when-using-umbraco-identity

Please Sign in or register to post replies

Write your reply to:

Draft