Sunday, February 18, 2024

The Curious Case of Misplaced Orders: A Tale from the Sitecore Content Hub Kitchen

Imagine walking into your favorite restaurant, your stomach rumbling in anticipation of that delicious meal you've been craving all week. You place your order with excitement, only to receive something entirely different. Confused, you look around, wondering if there's been a mix-up. But then, the waiter insists, "This is exactly what you ordered." Now, replace the restaurant with Sitecore Content Hub, the meal with React examples for version 4.2, and you have a scenario many developers, including myself, have recently navigated.

The Missing React Recipe

When Sitecore Content Hub 4.2 was freshly served, developers like us were eager to dive into the new features, especially those related to extending capabilities with React. However, the excitement quickly turned into a mild frustration as we scoured the documentation for React examples, only to find the kitchen seemingly bare. It felt like being promised a gourmet meal but ending up with an empty plate.

A Surprising Discovery

But then, as if by magic (or perhaps a curious exploration), we stumbled upon a hidden menu. Yes, React examples were there all along, but not where you'd expect them. They were tucked away under the "Users" section, a place we'd least expect to find our developer delicacies. It's akin to finding the chef's special not on the main menu, but scribbled on a napkin at the bar. An odd choice, indeed.

The Misplaced Order Dilemma

This peculiar placement brings to mind the restaurant scenario where you're served something you didn't order. In our case, we ordered developer resources but were handed user guides. It's a humorous mix-up, one that certainly brings a smile when you picture developers sifting through user manuals, searching for that secret sauce to spice up their Sitecore Content Hub projects.

A Public Appeal for a Menu Revamp

This brings us to a public question, or rather, a friendly nudge to our friends at Sitecore: Could we consider moving these React examples from the "Users" section to the "Developers" section? It's a small tweak, but one that could save future developers from the culinary confusion we faced. After all, code samples are like recipes; they belong in the hands of those cooking up the solutions, not those enjoying the meal.

The Silver Lining

Despite the initial mix-up, discovering these React examples under the "Users" section was like finding a hidden gem. It reminded us of the importance of exploring every nook and cranny, even in places we might not initially think to look. And, in a way, it added a dash of adventure to our development journey.

A Call to Action

So, to my fellow developers venturing into the world of Sitecore Content Hub, let this tale be a reminder to look beyond the obvious. Sometimes, the resources we need are just around the corner, albeit in an unexpected place. And to the wonderful team at Sitecore, perhaps it's time to consider a slight reorganization of the menu. After all, a well-organized kitchen is the key to a successful restaurant.

In the end, our tale of misplaced orders is more than just a humorous anecdote; it's a testament to the ever-evolving landscape of technology and the importance of clear, accessible documentation. As we continue to navigate the vast and sometimes confusing world of Sitecore Content Hub, let's do so with a sense of curiosity, patience, and a readiness to explore every section of the menu, no matter how strangely organized it may be.

Example: https://doc.sitecore.com/ch/en/users/40/content-hub/manage--external-page-events.html

Saturday, February 10, 2024

A Toast to Achievement: My Sitecore MVP Journey - Sitecore Technology MVP 2024


A Toast to Achievement: My Sitecore MVP Journey

As I sit down to pen this celebratory post, I'm enveloped by a sense of profound gratitude and a touch of pride. Not every day is one recognized by Sitecore with their coveted MVP award, and I am thrilled to share this moment with you, my readers, who have been an integral part of my journey.

A Mentor's Guidance: Timothy Marsh

First and foremost, I must extend my heartfelt thanks to Timothy Marsh. Timothy, your mentorship has been the guiding star through the intricate maze of Sitecore Content Hub DAM. Your wisdom and patience have helped me hone my skills and instilled in me the confidence to push boundaries and innovate. I sincerely appreciate the time and knowledge you've invested in me.

The Art of Integration

In the spirit of sharing knowledge, let's delve into the art of integration, a topic close to my heart. Sitecore Content Hub DAM is not an island; it thrives on its ability to seamlessly integrate with other systems. Take, for example, the integration with Sitecore Send, which allows marketers to leverage DAM assets in email campaigns, landing pages, and subscription forms. This synergy between systems transforms an excellent digital experience into a great one.

Customization: The Secret Ingredient

Customization is the secret ingredient that turns a standard solution into a tailored masterpiece. Extending the M.Asset Schema in Sitecore Content Hub allows us to untangle complexities and tailor the platform to our unique needs. It's akin to a chef in a gourmet kitchen, carefully adjusting flavors to create a dish that's both memorable and distinctive.

Best Practices: The Recipe for Success

Adhering to best practices is akin to following a tried-and-true recipe. It ensures that the final outcome is not only delectable but also consistent. From using account impersonation to test security access to applying your company's branding to the Content Hub theme, these practices are the foundation upon which we build robust and efficient systems.

The Blogging Craft

Writing a blog post is much like crafting a fine meal. It requires a blend of creativity, structure, and attention to detail. As we choose topics we understand well and generate compelling titles, we create an engaging and informative narrative. And just like a chef garnishes a dish before serving, we too must proofread our posts, add images, and ensure that our content is SEO-friendly

Expressing Gratitude

In the world of blogging, expressing gratitude is not just polite; it's strategic. It fosters relationships and builds a community of engaged readers. So, as I thank Timothy and all of you, I'm not just fulfilling a social nicety; I'm nurturing the very community that has supported me.

In Conclusion

As we close this chapter of my Sitecore MVP journey, I look forward to the many stories we'll share and the challenges we'll overcome together. Here's to the future, where we continue to learn, innovate, and lead in digital asset management.

I also want to extend my congratulations to my esteemed colleagues who have also been honored with the Sitecore MVP award. Your dedication and expertise inspire me, and I am proud to stand among such a distinguished company. Together, we form a constellation of talent that illuminates the Sitecore community and guides it forward.

Thank you, Timothy, and thank you, my readers. Let's raise our glasses to the journey ahead and to the collective brilliance of my fellow MVPs! This addition aligns with the celebratory tone of your blog post and provides a space to acknowledge your colleagues' achievements. Congratulations once again on your Sitecore MVP award!


Sunday, February 4, 2024

Adding Flavor to Your Search: A Recipe for Selection in Sitecore Content Hub


Welcome back to RestaurantOfMistakenOrders.com, where we continue to cook up delicious tech recipes. Today, we're adding a new ingredient to our Sitecore Content Hub dish: selection. Just as a chef carefully selects the best ingredients for a recipe, we'll use React and TypeScript to select and display the most relevant search results.

The Ingredients of Our Selection Recipe

In our digital kitchen, we're preparing a new function to add to our search functionality. This function is like a chef's special tool, allowing us to select specific items from our search results. Here's the recipe:

const selectionPoolIdentifier = "SelectionPool.Content";
const definitionNames = ["M.Asset"];

const selectionChanges = sqlDataResponse.map(item => {
return {
action: 'add' as 'add' | 'remove' | 'clear',
ids: [1334737,1334720], //example id's to be selected, or
use [item.id].map(id => Number(id)),
selectionPoolIdentifier,
definitionNames: definitionNames
};
});
applySelectionToSearch(context, selectionChanges);
export const applySelectionToSearch = (context: Context,
selectionChanges: { action: 'add' | 'remove' | 'clear', ids?: number[],
subPoolId?: number, selectionPoolIdentifier: string, definitionNames?: string[] }[]) => {
selectionChanges.forEach(change => {
const { action, ids, subPoolId, selectionPoolIdentifier, definitionNames } = change;

switch (action) {
case 'add':
context.api.selection.addToSelection(ids!, selectionPoolIdentifier, subPoolId);
console.log("ADD: call from function");
break;
case 'remove':
context.api.selection.removeFromSelection(ids!, selectionPoolIdentifier, subPoolId);
break;
case 'clear':
context.api.selection.clearSelection(selectionPoolIdentifier, subPoolId, definitionNames);
break;
default:
throw new Error('Invalid action type');
}
});
};

In this code, we're preparing our selection. We're specifying the selectionPoolIdentifier and definitionNames—think of these as the type of ingredients we're looking for. Then, we're mapping over our sqlDataResponse (our list of ingredients) and creating a new array of selectionChanges. Each item in this array represents a change we want to make to our selection.

The action property can be 'add', 'remove', or 'clear', representing whether we want to add an item to our selection, remove an item, or clear the selection entirely. The ids property is an array of the IDs of the items we want to add or remove.

Finally, we call the applySelectionToSearch function, passing in our context (the current state of our kitchen) and our selectionChanges (the changes we want to make to our dish).

The Cooking Process

Just as a chef carefully selects the best ingredients for a dish, our code selects the most relevant search results based on the user's input. When a user selects a filter, it's like choosing a specific ingredient for a dish. Our code then updates the search results accordingly, without the need for the page to refresh—much like a live cooking station!

The Final Touch

Just as a chef adds the final garnish to a dish before serving, our React and TypeScript code adds the final touch to the user experience by making search results more relevant and easier to digest. It's a seamless blend of technology and user satisfaction, ensuring that every visit to your Sitecore Content Hub is a five-star experience.

Conclusion: Bon Appétit!

With a pinch of React, a dash of TypeScript, and a sprinkle of creativity, we've cooked up a solution that's both efficient and enjoyable. Join us next time at RestaurantOfMistakenOrders.com for another tech recipe that's sure to satisfy your digital palate!