INTRODUCTION
What is OC.PowerSort?
OC.PowerSort extends Umbraco's native content tree functionality by providing advanced sorting features that go beyond simple alphabetical or creation date ordering. The package allows content editors to:
Sort content nodes using various criteria and custom providers
Schedule sorting changes to occur at specific dates and times
Create recurring sorting schedules that automatically apply on a recurring basis
Set priorities to control content order when multiple items have the same sort position
Define default sort orders that automatically apply to new content
Key Features
1. Enhanced Content Sorting
Multiple sorting strategies available out-of-the-box
Drag-and-drop interface for manual sorting
Visual tree representation of content structure
Apply sorting to any parent node's children
2. Schedule Management
One-time Schedules: Set content to move to a specific position at a future date/time
Recurring Schedules: Define patterns for content to automatically reorder on a recurring basis
Daily recurrence
Weekly recurrence (specific days of the week)
Monthly recurrence (specific day of month or day of week pattern)
Custom intervals
Schedule Duration: Control how long a boosted position remains active
Schedule End Dates: Set when recurring schedules should stop
Maximum Occurrences: Limit the number of times a recurring schedule runs
3. Priority System
When multiple content items share the same sort order position, the priority system determines which item appears first. This is particularly useful when combined with schedules, allowing editors to boost important content temporarily.
4. Default Sort Orders
Define default sorting behavior for specific parent nodes, ensuring consistent content ordering without manual intervention each time new content is added.
5. Extensible Provider System
Developers can create custom sort providers to implement business-specific sorting logic:
ISortProvider Interface: Clean abstraction for implementing custom sorting strategies
Built-in Examples:
DefaultScheduleSortProvider: Standard schedule-based sortingAlphabeticalSortProvider: Alphabetical orderingNewestFirstSortProvider: Sort by creation dateFeaturedContentBoostProvider: Boost featured contentPopularityBoostProvider: Sort by popularity metrics
Provider Factory: Automatic discovery and registration of custom providers
Architecture
Core Components
Services:
ScheduleService: Manages schedule CRUD operationsScheduleProcessingService: Executes scheduled sorting operationsRecurrenceCalculatorService: Calculates occurrence dates for recurring schedulesOccurrenceGenerationService: Generates schedule occurrences from recurring patternsSortProviderFactory: Discovers and instantiates sort providersSortingFlagService: Manages sorting flags and default behaviors
Controllers:
ScheduleAPIController: REST API for schedule managementRecurringScheduleApiController: REST API for recurring schedule operationsChildrenAndSortingAPIController: API for retrieving and sorting content treesMenuItemsApiController: Provides menu items for the backoffice interfaceEnumPriorityAPIController: Manages priority enumeration values
Models:
SortScheduleModel: Represents a one-time scheduled sort operationRecurringScheduleDto: Database model for recurring schedulesScheduleOccurrence: Individual occurrence generated from recurring schedules
Database Structure
OC.PowerSort creates several database tables to persist sorting information:
ocPowerSortSchedule: Stores one-time scheduled sort operationsocPowerSortRecurringSchedule: Stores recurring schedule patternsocPowerSortScheduleOccurrence: Individual occurrences generated from recurring schedulesocPowerSortDefaultSortOrder: Default sorting behavior for parent nodesocPowerSortEnumPriority: Priority enumeration values
Technical Requirements
Umbraco Version: 17+
.NET Version: 10
Database: SQL Server (compatible with Umbraco's database requirements)
Use Cases
Content Promotion
Automatically promote specific content items during campaigns or events. For example, boost a "Summer Sale" page every weekend during June and July.
Time-Sensitive Content
Schedule content to appear at the top of listings when it becomes relevant. News articles can automatically move to prominent positions when published, then return to chronological order after a set duration.
Event Management
Use recurring schedules to automatically promote event pages in the days leading up to events, ensuring users see upcoming events without manual intervention.
Seasonal Content
Set up recurring schedules to automatically reorder content based on seasonal relevance, such as promoting holiday-related content during specific months.
Editorial Workflows
Content editors can schedule sorting changes in advance, allowing for planned content strategies without requiring developer involvement or manual updates at specific times.
Integration
Backoffice Integration
The package adds a dedicated "PowerSort" section to the Umbraco backoffice, providing a dedicated workspace for managing sorting operations.
Frontend Implementation
OC.PowerSort updates the underlying sortOrder property of Umbraco content nodes. Frontend implementation is handled by developers using standard Umbraco content queries:
API Integration
RESTful APIs are available for programmatic access to scheduling and sorting functionality, enabling integration with external systems or custom backoffice extensions.
Extensibility
Creating Custom Sort Providers
Developers can implement custom sorting logic by creating classes that implement the ISortProvider interface:
Custom providers can:
Integrate with external systems (CRM, analytics, weather APIs, etc.)
Implement business-specific sorting rules
Combine multiple data sources for sorting decisions
Provide validation for configuration requirements
Provider Registration
Custom providers are automatically discovered and registered through the composer system. Simply implement ISortProvider and register it in the DI container.
Benefits
Editor Empowerment: Content editors can manage content presentation without developer assistance
Time Efficiency: Schedule sorting changes in advance, reducing manual workload
Consistency: Default sort orders ensure consistent content presentation
Flexibility: Extensible provider system allows custom sorting strategies
Automation: Recurring schedules eliminate repetitive manual tasks
Predictability: Scheduled changes occur exactly when planned, every time
Getting Started
Installation: Install the NuGet package
OC.PowerSortUser Permissions: Grant access to the "PowerSort" section for relevant user groups
Configuration: Define default sort orders for parent nodes (optional)
Usage: Navigate to the PowerSort section and start scheduling sorting operations
Resources
GitHub Repository: https://github.com/OwainWilliams/OC.PowerSort
NuGet Package: https://www.nuget.org/packages/OC.PowerSort/
Video Tutorials: Available in the README
License: MIT
Support and Community
For questions, issues, or contributions, please visit the GitHub repository or consult the contributing guidelines.
Credits
Created by:
License: MIT License
Last updated