EPiServer Archive

RabbitMQ connection tester application

We set up Optimizely‘s new on-prem event provider (EPiServer.Events.MassTransit) for my current client’s Optimizely 12 website the other week. At current date it is still in beta until there are enough uses for there to be a production release. For the mass transit we set up RabbitMQ. For earlier Optimizely (Episerver) versions built on ASP.NET Framework there was a tool for testing the event replication …

Simple way to use enums for sorting in Optimizely Search & Navigation

As stated in the Optimizely Search & Navigation developer documentation on Sorting, “Sorting is supported for numerical types such as int, double, DateTime, and string”. This means that you will get an error from EPiServer.Find.SortingValidationHelper.ValidateSupportedType if you attempt to sort on an enum field. There are of course various solutions to this problem, but here is a rather simple one: turn the enum into a string …

Finding the latest Optimizely Search & Navigation’s client Javascript URL

I got a question on how to find the latest version of the Search & Navigation /epi-util/find.js script file after publishing the article Proxy for Optimizely Search & Navigation tracking script. It is really quite simple, if you look at how Optimiezely does things. The solution is to make use of the built-in IPathHelper (namespace EPiServer.Find.UI.Helpers). Optimizely’s default GetClientResourceBasePath implementation essentially makes a request to …

Proxy for Optimizely Search & Navigation tracking script

When using Optimizely Search & Navigation (previously Episerver Find) you will automatically get a reference to a client side Javascript injected into your markup. Occationally, you may want to proxy it via your Optimizely website’s backend, caching it or just make it appear as if it comes from your own domain. It may also be a way of avoiding false positives in regards to script …

Getting the root PageReference of the imported pages in Episerver

In our work to automate export and import of the production database into our test environment we had to maintain a test node in the Episerver page tree. This ment that we had to export it before replacing the database, and then import it again. Please see Exporting Episerver content programmatically through an ApiController and Importing Episerver content programmatically through an ApiController for information about …

Importing Episerver content programmatically through an ApiController

Importing the test node package that we exported earlier (see article Exporting Episerver content programmatically through an ApiController) would be the next step in our automated transfer of the production database to the testing environment. I extended our ApiController with an import endpoint for this purpose. Note that this code is never intended to be deployed to production. Importing is easier than exporting. The relevant …

Exporting Episerver content programmatically through an ApiController

As part of the automated transfer of the production database to the testing environment for my current client we found the need to maintain a node in the Episerver page tree that is used for testing. I extended our ApiController with an export endpoint for this purpose. Note that this code is never intended to be deployed to production. So the interesting part happens in …

Tracing between logs with a correlation ID

Attempting to match timestamps and whatnot to correlate requests over various logs may be quite tedious. Adding a correlation ID to your website makes this easier and may save you quite a bit of time. This is what we did at my current client for all of their Episerver websites. I Implemented this together with my collegue Svante Seleborg. Passing a correlation ID through your …

Episerver upgrade: Could not find a part of the path {wwwroot}\ClientResources\ClientResources\packages.config.

Just a short note on an exception I got after upgrading the Episerver NuGet packages on a few of my client’s websites. All of them worked perfectly, except the one that gave me the following message: It is the package.config inside the Shell.zip that it’s looking for. It turns out that the package installation had removed a few lines from the configuration file.

Passing data between your own ContentSecuritySaving and ContentSecuritySaved event handlers in Episerver

If you want to pass information between a PublishingContent handler and a PublishedContent handler (EPiServer.Core.IContentEvents) it is quite easy as the internal code provides you with a Dictionary property on the ContentEventArgs object. This may be useful if you need to maintain information about a property value through an entire publishing process. I.e. find out if the editor changed the value of the property. So, …

Passing custom IContentSerializerSettings to JOS Content Serializer

We use the JOS.ContentSerializer to provide JSON for React in a platform project at my current client (7 Episerver websites spread over 5 installations). For this we needed to provide the JOS.ContentSerializer with custom settings via the IContentSerializerSettings interface to use in our custom property handlers. However, we encountered some difficulties doing this and here is how we (temporarily) solved it. I will make the …

The danger of intersecting Episerver content

Some time ago we had a rather elusive bug on one of my client’s Episerver websites: occationally an item would disappear from a menu, even though no editor involvement had been noted for at least 6 months. My collegue Svante Seleborg found the rather interesting cause of the problem. Intersecting Episerver content We had a line of code intersecting two collections of pages, like this: …

Adding an index xml-file with GETA SEO Sitemaps for Episerver

Sometimes you need a sitemap index file for easing access to multiple sitemaps. Here is a way of creating one using a custom generator for GETA SEO Sitemaps, described in Multiple custom sitemap.xml generators with GETA SEO Sitemaps for Episerver. The UseGeneratorFor method will expect the index file to be named sitemap.xml, so be sure to create one of those in your Episerver admin mode …

Multiple custom sitemap.xml generators with GETA SEO Sitemaps for Episerver

At my current client’s, we’re building a common platform code base supporting 5 Episerver multisite installations. These all have different needs when it comes to xml sitemaps. Here is an easy way of adding custom sitemap generation and have the GETA SEO Sitemap functionality use it. Overriding the generator factory The first thing we need to do is come up with a way of recognizing …

EPiServer License information: A error occured while loading the license file.

Short note-to-self: if replacing contents of an Episerver license file using variables in Octopus Deploy, make sure the file uses the proper encoding, or you may find yourself facing the following error message: At a client of mine the Episerver license is written to the episerver.license-file using Octopus Deploy. Initially the file only contains the Octopus variable placeholder #{EpiserverLicense} which is then replaced for each …

Simple string encryption for the EPiServer Dynamic Data Store

This is part of the short dynamic data store article series I mentioned before. The layer mentioned may be found in Simple EPiServer Dynamic Data Store (DDS) layer and was mainly created to ease unit testing of DDS code. Since there may be a need to store sensitive information in the DDS I have extended this DdsService with encryption functionality (the actual encryption is not …

Rendering preview blocks with Advanced Reviews while using React for Episerver websites

We are trying out the Advanced CMS add-on Advanced Reviews for one of our Episerver websites at my current client. The thing is that we are also using JOS Content Serializer for turning our Episerver content items into serializable objects in order to feed our React frontend (described in previous articles). This caused issues for external reviewers while trying to preview ContentArea blocks in view …