Try Now
More in this section

Forums / Developing with Sitefinity / Preview blog post in a specific page

Preview blog post in a specific page

3 posts, 0 answered
  1. Marko
    Marko avatar
    148 posts
    30 Jul 2008
    28 Feb 2012
    Link to this post
    First of all, if this functionality exists out-of-the-box, please let me know.  I don't see it.

    I'm looking for a way to allow blog content creators to preview their blog posts within the context of a front-end PAGE, not just in the sitefinity backened.  The reason for this is that blog post preview in the backend does not truly represent what the publicly-seen blog post will look like, because the front-end pages delivering the blog content might have some custom CSS styling.  This CSS does not apply in the backend, so it's difficult for people to know what the published content ultimately looks like before publishing it.

    For example, when modifying a PAGE, you can click on the PREVIEW button and see the page fully rendered in the front-end, in its template and any applied styling.  I want to do this for blogs, as well.  In fact, if I just go to a front-end page containing BlogPosts control and I manually type in the URL of a saved-but-not-yet-published blog post, I can see it rendered just fine in the browser.  So what I need is a PREVIEW button in the backend to make this happen dynamically.

    So I'm thinking this:

    1. Map an external template for Telerik.Blogs.WebControls.Admin.PostPreviewView
    2. Add a PREVIEW button right next to the EDIT button
    3. Extend the code-behind/class for that template to construct the preview link to point to the "Post Page" URL (which is set under Blog Settings for each blog in the backend) and more specifically, to the current blog post's URL in the Post Page.

    So, like I said, first of all let me know if this functionality exists out of the box and I'm just missing it somehow.  If not, I need help with #3 above, because I don't know how to use custom code on a mapped external template for PostPreviewView.  I know that I can extend the class Telerik.Blogs.WebControls.Admin.PostPreviewView but how do I then tell the mapped template to use the extended class?

  2. Stanislav Velikov
    Stanislav Velikov avatar
    1113 posts
    20 Oct 2016
    02 Mar 2012
    Link to this post

     This functionality doesn`t exist out of the box, there is no preview for blogs in Sitefinity 3.x. This functionality is available in Sitefinity 4 . I suppose you are refering to sitefinity 4?
    To view the preview on the frontend page won`t work with the current design of the preview. 
    The preview gets a temp version of the blog post (there is a live and master version) and makes a preview of the values.
    The live version is shown on the frontend and to preview to the frontend the post must be published because temp versions are only created when the post is edited or created and it is not saved.
    When saved the temp version becomes master version which is the actual blog post and the live version is the same as master version with visible=true so it is visible to the frontend.
    This is governed by Sitefinity content lifecycle. This makes it impossible to preview the blog post on the frontend because the post should be published first and this will require closing the edit dialog where the preview button is.
    Unfortunately this is not possible with the current arcature content modules handle content lifecycle.

    Kind regards,
    Stanislav Velikov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Marko
    Marko avatar
    148 posts
    30 Jul 2008
    02 Mar 2012
    Link to this post
    Hmmm... There seem to be some contradicting information here.  Here's what I was able to produce:

    1. Make sure Workflow is turned on for Blogs
    2. Make sure you have a page with BlogPosts control and publish it
    3. Make sure you have some blog posts that have been published already.
    3. In Blogs module, create a new blog post.  Call it Test123.  Add some text.  Save it, but don't publish it yet.
    4. Navigate to the public view of the page containing the BlogPosts control.  You won't see the "Test123" post because it hasn't been published yet. Makes sense. But click on one of the other blog posts to view it in single-item view. 
    5. Take a note of the URL structure (obviously, this can be different for you as it is customizable in web.config).  Change the date in the URL to the date of Test123's post and change the title to "Test123.aspx."
    6. Hit Enter, and viola!  It displays the Test123 post which is really a "draft" and hasn't been published yet.

    So I thought, if this works for all saved-but-not-published posts, then all I have to do is find a way to construct the URL and send people there.  This is effectively "preview" is it not?  Is that a bug?  :-) 

    However, this only works for blog posts that have not been published yet.  For example, if you edit one of the previously PUBLISHED blog posts, save it, and visit its single-item view in the frontend, you will only see the previously published version.  Of course, that makes sense, because the whole point of having unpublished drafts is that the public won't see it.

    So anyways... it's probably not worth developing a solution for this in 3.7, because we will eventually upgrade...  But I thought I'd entertain the idea, and if it was something simple, I'd do it.  Otherwise, wait for the Migration tool to mature so we can finally move to 4 or 5, but that's another topic.  :-)
Register for webinar
3 posts, 0 answered