Enable Quick Page Editing from Your Xperience by Kentico Website Channels
23/08/2024If you’ve worked with earlier versions of Kentico using Portal Engine and ASP.NET Web Forms, you might remember the handy "Edit Page" button that appeared on the website’s front-end for authenticated content editors.
Does that sound familiar? 🤔
I’d actually forgotten about it 😂 until one of our Xperience by Kentico clients asked if it was possible to enable this feature. Given their experience with it on their previous site, it was a natural request to see if it could be integrated into Xperience by Kentico.
I thought it was a brilliant idea to develop an open-source package that reintroduces the "Edit Page" button functionality in Xperience by Kentico. My main challenge was figuring out how to determine if a website visitor was authenticated in the administration portal. Unlike earlier versions of Kentico, where front-end users and administration users were the same, Xperience by Kentico differentiates between administration users and front-end members. This change added a layer of complexity, making the implementation of this feature both intriguing and valuable.
Before diving into development, I wanted to explore the best method for checking if a website visitor was authenticated in the admin site. After discussing various ideas in the community portal, I found that using HttpContext.AuthenticateAsync was the most effective approach. This method allows you to verify if a user is authenticated under a specific authentication scheme. For instance, you might have a specific scheme set up for your front-end visitors if it has an account area with gated content. To make sure that this new package was using the right scheme, I used the following constant, AdminIdentityConstants.APPLICATION_SCHEME.
Once I resolved the authentication check, I proceeded to create a ViewComponent to manage the rendering of the "Edit Page" button. This component not only handles the display of the button but also dynamically generates the correct admin page URL based on the current page being viewed on the front-end. This setup ensures that content editors can easily navigate to the appropriate administration page for quick editing. ⚡
I recommend checking out the GitHub repository for detailed instructions on setting up the package in your project. You'll find comprehensive guidelines as well as the source code for the ViewComponent that handles the button rendering and URL generation. 👀 Explore the repository to get a closer look at how it all works!
You might also be interested in...
How to Easily Extend Xperience by Kentico UI Pages with Page Extenders
13/09/2024UI page extenders in Xperience by Kentico allow you to customise existing UI pages without modifying their source code. In this post, we’ll walk through a simple example of reordering columns in a listing layout to better suit your needs.
Boost Site Speed Using Image Processing for Xperience by Kentico
05/08/2024Discover how the XperienceCommunity.ImageProcessing package can significantly enhance your website's performance in Xperience by Kentico. This integration allows for resizing images and converting them to modern formats like WebP, resulting in faster page loads and improved user experience.
A Guide to the Xperience by Kentico Certified Developer Certification
30/07/2024Discover the newly extended Xperience by Kentico Certified Developer certification, designed to showcase your expertise in the platform. Learn about the certification process, key topics covered, and tips for success from a Kentico MVP. Perfect for developers looking to validate their skills and advance their careers.