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.
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"/>
in the 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 BucketConfiguration.BucketFolderPath setting, it still creates the same folders using the pattern 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.
This happens because Sitecore falls back to the default value
yyyy\\/MM\\/dd\\/HH\\/mmif the settingBucketConfiguration.BucketFolderPathis missing: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:Please note that the setting
BucketConfiguration.BucketFolderPathis only used if no rules are added to the itemItem Buckets Settings. So if you keep the rules field empty, it is possible to modify the settingBucketConfiguration.BucketFolderPathvia a config patch similar to this: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.