Protect Sitecore Media Library with ClamAV antivirus

Posted 9 Sep 2024 by Marek Musielak

protect sitecore media library with clamav antivirus

Have you ever wondered what kind of files are uploaded to Sitecore media library by content authors? Do they run any antivirus checks before uploading them? Do they check them in any way or do they only push what they receive without any thinking if the file is not a malicious one. Or maybe there is an option to upload files to the Sitecore media library from a form on your website? This blog post provides a guide how you can run an antivirus check of any file before it is stored in media library.

continue reading Protect Sitecore Media Library with ClamAV antivirus »

Resolving Sitecore placeholder settings issue related to Query.MaxItems config

Posted 30 Aug 2024 by Marek Musielak

sitecore add rendering to a placeholder

One of the questions in Sitecore developer training asks why a newly added placeholder in a view file might not be rendered in Experience Editor, preventing content authors from adding components to that placeholder. The answer suggests that the Sitecore placeholder definition item with the specified placeholder key was likely not created. But there may be another reason. In this blog post, I will explain how Sitecore determines how to render placeholders in Experience Editor and discuss a potential issue that may arise if the Query.MaxItems config value is set too low.

continue reading Resolving Sitecore placeholder settings issue related to Query.MaxItems config »

Securing mailto links using Sitecore Publish Replacer

Posted 28 Aug 2024 by Marek Musielak

obfuscate mailto links with sitecore publish replacer

Including mailto: links on your website can be a great way to make it easy for potential clients to contact you. However, it also opens up the risk of your email address being harvested by malicious bots and added to spam lists. This blog post will explain how you can protect your email address in mailto: links, using the Sitecore Publish Replacer functionality.

continue reading Securing mailto links using Sitecore Publish Replacer »

Extend Sitecore Forms Designer with publish functionality

Posted 16 Aug 2024 by Marek Musielak

extend sitecore forms designer with publish functionality

One day I was asked by one of our clients if we could extend the Sitecore Forms Editor with an option to publish a Sitecore form directly from the Forms Editor, instead of having to go back to the forms list, find the form, and publish it there. At Blastic, we always want to make sure that our clients are more than happy, so we found a way to add a button to the Sitecore Forms Editor and allow content authors to publish the form they are editing without navigating out of that tool.

continue reading Extend Sitecore Forms Designer with publish functionality »

Implement tooltips for fields in Sitecore Forms

Posted 26 Mar 2024 by Marek Musielak

sitecore forms - tooltip in form

Improving your website's user experience often means giving clear guidance, especially for forms. In this blog post, I'll guide you through the process of integrating tooltips into Sitecore Forms. Tooltips are those small bubbles that give users helpful hints as they fill out forms. Adding tooltips brings big benefits: it makes forms easier to use and helps users understand them better, making your Sitecore-powered website more engaging.

continue reading Implement tooltips for fields in Sitecore Forms »

Sitecore: Multi-Root Search in 'Multilist with Search' Fields

Posted 29 Feb 2024 by Marek Musielak

sitecore: multi-root search in 'multilist with search' fields

Many developers have encountered the challenge of facilitating content authors who need to select items from various parts of the Sitecore content tree using the Multilist with Search field type. Out of the box, this feature restricts searches to a single root, posing limitations for content management. However, in this blog post, we'll explore how to enhance this functionality by enabling the field type to support query results in multiple items, thus allowing searches across multiple roots of the Sitecore content tree.

continue reading Sitecore: Multi-Root Search in 'Multilist with Search' Fields »

Sitecore - issue while checking xDB index rebuild status with Azure Search Explorer

Posted 4 Dec 2023 by Marek Musielak

sitecore - issue while checking xdb index rebuild status with azure search explorer

If, by any chance, you still need to support older Sitecore versions and Azure Search, you may be unpleasantly surprised to find that Azure Search queries, used for checking the status of rebuilding the xDB index as mentioned on the Sitecore documentation website, no longer work in Azure Search Explorer.

continue reading Sitecore - checking xDB index rebuild status with Azure Search Explorer »

Sitecore - efficiently unlock all items with Powershell

Posted 11 Oct 2023 by Marek Musielak

effectively unlock all the items with sitecore powershell extensions

Below you can find Sitecore Powershell Extensions script that will efficiently unlock all Sitecore items.

continue reading Sitecore - efficiently unlock all items with Powershell »

Guidance on returning a 404 Page Not Found response in Sitecore when an item lacks a language version

Posted 10 Aug 2023 by Marek Musielak

return page not found response if sitecore item has no language version

Scenario: despite the fact that Sitecore item has no version in a certain language, one can still navigate to the url of that language version and Sitecore returns 200 OK result with pretty much blank page containing only shared fields values.
Solution: check whether current context item has any version in current language. If there is no version, assign null to Sitecore.Context.Item

continue reading Return 404 Page Not Found response if Sitecore item has no language version »

Sitecore - Content Editor search with custom keyword

Posted 17 Feb 2023 by Marek Musielak

sitecore content editor search custom

I recently discovered that Sitecore Content Editor Search not only allows default searches by ID, path or search term, but also allows searching with custom keyword, restricting which field should be checked.

continue reading Sitecore Content Editor Search with custom keyword »

Sitecore - alternate hreflang links for SXA

Posted 6 Feb 2022 by Marek Musielak

sitecore hreflang alternate links for sxa

When you run a multilanguage site on Sitecore, you definitely want to tell Google about all the available translations of your content. Thanks to that Google Search will be able to point users to the most appropriate version of your pages. How you can achieve this? By adding rel="alternate" hreflang links in <head> part of your html.

continue reading Sitecore - alternate hreflang links for Sitecore SXA »

Sitecore - publish all items linking to a particular item

Posted 14 Dec 2021 by Marek Musielak

sitecore publish all items linking to a particular item

Sometimes you need to publish all items linking to a particular Sitecore item. While Sitecore has an option to publish item with related items, it only publishes items which are referenced from the item. It does not publish items which link to selected item. Here is easy Sitecore Powershell Extensions script which allows to publish all the items which refer to your selected item:

continue reading Sitecore - publish all items linking to a particular item »

Workaround for Sitecore Content Editor search issues

Posted 7 Mar 2021 by Marek Musielak

sitecore content editor search not working

Recently I encountered a strange issue. Search tab in Sitecore Content Editor stopped working, but only for content authors. For admins everything worked as before. My first guess was "access rights" but that wasn't it. The problem was with how Sitecore builds Solr query when users use Search tab in Sitecore Content Editor.

continue reading Workaround for Sitecore Content Editor search issues »

Automatically unpublish deleted Sitecore item

Posted 9 Feb 2020 by Marek Musielak

unpublish sitecore item while deleting

Many many times I heard a question: I deleted an item but I can still see it on the website. Why?. If you've been working with Sitecore for a while, you don't even have to check to know the answer: You've deleted an item but you haven't unpublished it first. Is there anything we can do to help content editors with that problem?

continue reading Automatically unpublish deleted Sitecore item »

Publish specific version of Sitecore item

Posted 22 May 2019 by Marek Musielak

publish selected version of sitecore item

When Sitecore publishes an item, it always publishes the most recent valid version of that item. It checks workflow state, publishing restrictions, item validity dates and newer versions. But what if we want to publish a version of an item which has no publishing restrictions but there are newer versions of that item?

continue reading Publish specific version of Sitecore item »

Sitecore page level rules engine personalization

Posted 4 Mar 2019 by Marek Musielak

sitecore rules engine

If you've been working with Sitecore for a while, I'm sure you're familiar with Sitecore Rules Engine. And I'm sure you've used it plenty of times. I bet you used it with Conditional Renderings, maybe with Insert Options Rules or with EXM. But have you ever wanted to execute your custom rules for every page your visitors browse? This article explains how I achieved it and provides a link to Sitecore content package which will allow you do to the same in your Sitecore application.

continue reading Sitecore page level rules engine personalization »

Archive Sitecore logs with 7zip and Task Scheduler

Posted 30 Dec 2018 by Marek Musielak

archive sitecore logs with 7zip and task scheduler

This article explains how to automatically zip your Sitecore log files with 7zip and Windows Task Scheduler.

continue reading Archive Sitecore logs with 7zip and Task Scheduler »

Sitecore Unlock Item Command

Posted 31 May 2018 by Marek Musielak

sitecore unlock item

This article explains how to add Unlock Item command button in Sitecore Content Editor.

continue reading Sitecore Unlock Item Command »

Sitecore Registry Editor

Posted 21 May 2018 by Marek Musielak

sitecore registry editor logo

Sitecore Registry is a place where Sitecore stores user data, e.g. data related to the user editing preferences and choices. From time to time, people ask how this data can be altered. The answer is to use Registry.SetValue("/Current_User/SOME_KEY", value). Sounds easy but:
a) How to know what key should be used?
b) How to make sure that what we set is stored?
c) What other things can be set there?
To help with all those questions, I've created a simple SitecoreRegistryEditor.aspx page.

continue reading Sitecore Registry Editor »

Make Sitecore EXM faster with "NumberThreads" and "SendMail" pipeline "Sleep" config settings

Posted 6 January 2018 by Marek Musielak

make sitecore exm faster with numberthreads and sendmail pipeline sleep config settings

TL;DR Never trust default settings. Try, test and see what works best for you.
Quite recently I learned about 2 settings which helped me to send my Sitecore EXM mail campaigns many times faster. I was using default settings which comes with a fresh EXM installation. And now I learned my lesson: if you want to use a Sitecore module, read all its config files and check if there is anything interesting in them.

continue reading Make Sitecore EXM faster with NumberThreads and SendMail pipeline Sleep config settings »

Sitecore - proper way of adding contacts to contact lists

Posted 13 November 2017 by Marek Musielak

sitecore list manager

Not that long ago I was asked to write a code which will allow to subcribe users to a Sitecore contact list. Task was really simple - let's create a form with few fields and after user submits the form, we should update properties of the current Sitecore contact and subscribe to the selected list. I never worked with Contact Lists before, so I started to google and found many different ways how to achieve what I needed. I tried few of them and nothing worked for me. Some of them added the contact to the list, but the recipients number of the list was not updated, others caused that list was locked forever and never indexed properly.

continue reading Sitecore - proper way of adding contacts to contact lists »

Sitecore Rules Engine - Has Visited Certain Page Given Number Of Times Condition

Posted 22 June 2017 by Marek Musielak

sitecore rules engine

I've recently saw a question on StackOverflow where one asked how to „make a module on a page show up the first time you visit the page“. There is a Sitecore built in rule "where the [specific page] has been visited during the current visit" but the code which counts the page visits is called before the rule is executed, so if you try to use "except where the [specific page] has been visited during the current visit", it will always be false on that specific page, even when you open it for the first time. I haven't found any OOTB solution, so I've created my own condition: HasVisitedCertainPageGivenNumberOfTimesCondition.

continue reading Sitecore Rules Engine - Has Visited Certain Page Given Number Of Times Condition »

Sitecore Template Manager - fix for the Tab key

Posted 12 June 2017 by Marek Musielak

sitecore template manager - fix for the tab key

Editing Sitecore templates - every Sitecore developer does it. It doesn't matter if you're using Template Manager application or if you create and edit Sitecore templates in Content Editor, there is one thing which is broken in both. It's the tab key functionality.

continue reading Sitecore Template Manager - fix for the Tab key »

Sitecore Item Controller - the hidden gem of Sitecore MVC

Posted 27 November 2016 by Marek Musielak

sitecore page controller - sitecore item controller - sitecore layout controller

Not many people know about Sitecore Item Controller and what its role in Sitecore MVC is. is responsible for executing PageContext.Current.PageView property, which runs mvc.getPageRendering pipeline and returns html defined by the Sitecore MVC item layout. OK, so why is it important and how can I use it? One thing you can do is changing the way how Sitecore executes MVC page requests. Interesting but a little bit scary. I wouldn't trust that after upgrading to the next Sitecore version, my code still works. But there is another thing you can do. You can execute any code you want before or after Sitecore renders any MVC page. You can say that with httpRequestBegin and httpRequestEnd pipelines you can do the same. That's true, but with Sitecore Page Controller you can define different code for every template or even item. How? Read the post to see how I used Sitecore Item Controller and Sitecore Rules Engine to allow Sitecore Editors to use Rules Engine to specify different settings based on whatever condition they want.

continue reading Sitecore Item Controller - the hidden gem of Sitecore MVC »

Sitecore Rules Engine - decimal macro

Posted 16 October 2016 by Marek Musielak

sitecore decimal macro double macro floating point number macro

Some time ago I worked on a project where we had access to plenty of numeric data stored in the fields of our content items. The plan was to use this data to personalize the content on the site. Some of the data was decimal numbers. I hoped to use a built-in Sitecore macro which would allow me to create a condition like where the decimal value of field compares to number but to my surprise, there was no macro for decimal or any other floating point number.

continue reading Sitecore Rules Engine - decimal macro »

Sitecore Item Buckets - custom folders structure

Posted 3 December 2015 by Marek Musielak

sitecore item buckets - custom folder structure

Item Buckets allow you to store millions of items in Sitecore tree without worrying about the structure of the nested items. In theory, you should only use Item Buckets for the data which does not require any hierarchy. Also you should not have to browse the Sitecore content tree looking for items in the buckes. Still, sometimes we need to find an item in the tree and it's not that easy when the only help we have is default Sitecore date-based folder structure of Item Buckets. Fortunately, Sitecore allows to change the structure of Item Bucket folders easily.

continue reading Sitecore Item Buckets - custom folders structure »

Sitecore Insert Options Rules

Posted 25 November 2015 by Marek Musielak

sitecore insert option rules

One of the first thing which is explained to Sitecore Developers during the certification courses are Sitecore Insert Options. Everyone knows them. Configure -> Assign and it's all set. However not many people have ever heard about or used Insert Options Rules.

continue reading Sitecore Insert Options Rules »

Sitecore Preview Mode - see what is personalized

Posted 28 March 2015 by Marek Musielak

sitecore conditional renderings personalization preview

Sitecore personalization is a brilliant functionality. Every Sitecore implementation should make a proper use of it. If your application doesn't, it simply does not take the advantage of what Sitecore is capable of.

One thing I've always missed in Preview Mode of Sitecore Page Editor is an option to see which components are personalized and how do they look like in every personalized variant. You can do this in Edit Mode, but all the Sitecore javascripts, reloading the page when selecting personalized version and additional html tags added by Sitecore, they all intrude with proper initialization of components and with ease of use. This blog post explains how I added functionality of previewing Sitecore conditional renderings to the Preview Mode of Sitecore Page Editor. Video below shows how it works:

continue reading Sitecore Preview Mode - see what is personalized »

Sitecore - automated validation of MVC rendering DataSource

Posted 19 October 2014 by Marek Musielak

sitecore - automated validation of mvc rendering datasource

The project I'm working on now is based on Sitecore MVC. Lot of custom renderings, lot of configuration for them and lot of editable content. Most of the component data is stored in DataSource items and without DataSource item selected they make no sense and they don't provide any value. I was sick of placing if (DataSourceItem == null) { ... } code in every single component so I automated this process using Sitecore <mvc.getRenderer> pipeline.

continue reading Sitecore - automated validation of MVC rendering DataSource »

Using SwitchOnRebuildSolrSearchIndex Solr provider for Sitecore

Posted 5 October 2014 by Marek Musielak

sitecore and solr - custom field reader and indexing

Few days ago a colleague of mine, Dave, asked me why we hadn't been using SwitchOnRebuildSolrSearchIndex Solr provider in our Sitecore solution. I've heard about SwitchOnRebuild provider for Lucene but never about Solr one and neither had at that time Google. But SwitchOnRebuildSolrSearchIndex class exists so someone must know something. I asked about it on twitter. 13 minutes later Martina Welander replied to my tweet and one hour later I've received an email with documentation.

continue reading Using SwitchOnRebuildSolrSearchIndex Solr provider for Sitecore »

Sitecore and Solr - custom field reader and indexing

Posted 30 August 2014 by Marek Musielak

sitecore and solr - custom field reader and indexing

Nowadays Solr-powered Sitecore solutions are more and more popular and easier to setup. Stephen Pope and Sitecore team are doing great job there. Sitecore 7.2 provides a lot of support for Solr out of the box but there are still some scenarios when you need to extend Sitecore to fit your needs. Just recently I needed to implement a custom way of indexing and retrieving item fields for Solr.

continue reading Sitecore and Solr - custom field reader and indexing »