2

I have been trying to implement an approach for a custom folder structure in the tap repository on buckets. In this approach, I have commented out the following line:

<!-- <setting name="BucketConfiguration.BucketFolderPath" value="yyyy\/MM\/dd\/HH\/mm"/> -->

in Sitecore.Buckets.config file. However, even after doing this, when I click on the tag button, the Sitecore tagging job runs and creates the same folders like yyyy/MM/dd.

[Bucket config] (https://i.stack.imgur.com/p8fw9.png)

[folder Structure] (https://i.stack.imgur.com/7PYf3.png)

If I disable the default BucketFolderPath setting, then we can implement the following setting:

 <setting name="BucketConfiguration.DynamicBucketFolderPath" value="Sitecore.Buckets.Util.BucketFolderPathResolver, Sitecore.Buckets"/>

Sitecore.Buckets.config file. By enabling this setting and using the IDynamicBucketFolderPath interface, we should be able to customize the folder structure.

In the GetFolderPath function and bucket rules, we can implement our own folder structure.

However, I'm still facing a blocker. Despite commenting out the BucketFolderPath setting, it still creates the same folders like yyyy/MM/dd. I have tried a lot, but I haven't found a solution yet. If anyone has any ideas or knows a way to disable this behavior, please let me know.

Ref URL: https://doc.sitecore.com/xp/en/developers/90/sitecore-experience-manager/custom-bucket-structures.html

Thanks in advance.

1
  • Check if there are any other settings that might be overriding the BucketConfiguration.BucketFolderPath setting.
    – Alexander
    Aug 16, 2023 at 8:37

1 Answer 1

0

This happens because Sitecore falls back to the default value yyyy\\/MM\\/dd\\/HH\\/mm if the setting BucketConfiguration.BucketFolderPath is missing:

public class BucketConfigurationSettings
{
    public static string BucketFolderPath => Settings.GetSetting("BucketConfiguration.BucketFolderPath", "yyyy\\/MM\\/dd\\/HH\\/mm");
}

So commenting out this setting does not actually change anything because the same value is specified in the code by default.

The preferred approach for customising bucket folder structure is adding rules to the item /sitecore/system/Settings/Buckets/Item Buckets Settings, for example the rule below will create 3-level folder structure based on the first characters of item name:

Rules for custom folder structure

Please note that the setting BucketConfiguration.BucketFolderPath is only used if no rules are added to the item Item Buckets Settings. So if you keep the rules field empty, it is possible to modify the setting BucketConfiguration.BucketFolderPath via a config patch similar to this:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <sitecore>
    <settings>
      <setting name="BucketConfiguration.BucketFolderPath" value="yyyy"/>      
    </settings>
  </sitecore>
</configuration>

Value of this setting should either be a date format or a static string. If you replace it with an empty string, it will create a folder with the name "Repository" be default.

Hope this explains how bucket folder resolving works in Sitecore.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.