21

I have outlined 3 options for you below. Rocks is perhaps the easiest to setup and use but isn't so easy to use on remote environments. SPE is perhaps the most flexible and powerful option. Writing code against the APIs is quick and dirty but gets the job done. So there is no right answer really, it depends on your use-case. Option 1: Sitecore Rocks You ...


17

Sitecore PowerShell Extensions provides a great way to create items in bulk. Here is a simple script. foreach($index in 1..10) { $item = New-Item -Path "master:\content\home\sample item$($index)" -ItemType "Sample/Sample Item" $item.Title = "Auto-generated index $($index)" } Check out the Gitbook for SPE here for more details. Pro In a few lines ...


17

What is a Headless CMS? A headless CMS is a back-end only content management system (usually built from the ground up as a content repository) that makes content accessible via an API for display on any device. A Headless CMS focuses entirely on the administrative interface, workflows, collaboration and the organization and delivery of content. It doesn’t ...


13

Sitecore's built in disablers, like the SecurityDisabler and the EventsDisabler classes, all inherit the Sitecore-provided Switcher class. This class is an IDisposable that can be used to create disablers for use in both pipeline processors and event handlers, without issue. The Switcher class is easy enough to implement, but I have written a more readable ...


13

You are correct, you probably have come across this. The Sitecore.StringUtil, Sitecore.Kernel class contains a number of methods for managing strings. The two methods in particular are: StringUtil.GetSizeString(long size) This method takes in a long value 524288000, and returns a string representation of "512MB" StringUtil.ParseSizeString(string value) ...


11

Yea. Change your code to this: var templatePath = "User Defined/Project/Common/Content Types/Links"; var template = TemplateManager.GetTemplate(templatePath, Context.Database); If your path starts with "/", Sitecore will assume it to be absolute.


11

In addition to the built-in helper method, the pageState (normal, preview, editing) and pageEditing (boolean) properties are also available in the layout service context, which there are samples of in each JSS sample app:


10

Yes, it is possible to achieve your architecture using Sitecore. There are a few options for you here to do headless implementations, each with their own advantages and disadvantages, and different version/licensing implications. JSS (jss.sitecore.net): Currently in Tech Preview, this requires Sitecore 9 and a subscription/consumption license (as mentioned ...


10

You should have a look at the documentation form Sitecore: https://doc.sitecore.net/sitecore_experience_platform/80/setting_up_and_maintaining/search_and_indexing/indexing/rebuild_search_indexes You can rebuild indexes from custom code by using this: // To rebuild "new" search indexes, use this piece of code for every "new" index IndexCustodian....


10

Full disclosure: I'm on the JSS team, so naturally I'm biased. Contentful is fairly similar to using Sitecore's SSC REST APIs. You have a large bucket of content, and you have an API to retrieve chunks or lists of it. It's relatively standard headless SaaS. JSS delivers the full power of Sitecore by delivering headless layout capabilities. Instead of ...


9

Sitecore actually provides an OOTB item generator tool, named "FillDB." You can access this tool by navigating to http://yoursite.com/sitecore/admin/filldb.aspx. Before you can use the tool, you will have to enable it via the EnableFillDB config setting. Pros Tool is OOTB and supported by Sitecore Config setting ensures access is only granted when a ...


9

Sitecore stores its date/time values in UTC. And you are 5h30m ahead or behind UTC. If you'd like to display DateTimes in Server Time: webDB = Sitecore.Data.Database.GetDatabase("web"); var item = webDB.GetItem(itemId); var dateField = (DateField)item.Fields["fieldName"]; var serverTime = Sitecore.DateUtil.ToServerTime(dateField.DateTime); _xxx = Sitecore....


9

These items can be queried using code like this: var siteInfo = ServiceLocator.ServiceProvider.GetService<ISiteInfoResolver>().GetSiteInfo(Context.Item); if (siteInfo != null) { var siteContext = new SiteContext(siteInfo); var dictionaryPath = siteContext.Properties["dictionaryPath"]; }


8

This is a tricky question to answer as what is "best" can often depend on your solution. So let's look at the options: Item Web API - as @sitecorebasics said, the Item Web API is not supported in later versions of Sitecore, so even if you are on a version that it supports, I would not use it as it will make upgrades harder. Sitecore Services Client - This ...


8

"Statistics.CreatedBy" property does not return standard values. To fix this problem please use : blogPost.Fields["__created by"].Value Statistics.Created use next code: private string GetFieldValue(ID fieldId) { Field field = this._item.Fields[fieldId]; return field.GetValue(false, false) ?? string.Empty; } where field.GetValue has next ...


8

You cannot use the existing data directly to go from drop list to droplink as they stored data differently. Droplist has the display name, and droplink has the GUID of the item. In order to convert, I would usually suggest introducing a new field rather than changing the field, and forcing readonly permissions onto the old Droplist field so that it can be ...


8

That would be isExperienceEditorActive defined in @sitecore-jss/sitecore-jss. Usage: import { isExperienceEditorActive } from "@sitecore-jss/sitecore-jss"; if (isExperienceEditorActive()) { // Do something special in the Experience Editor } This file also contains other very useful functions. Credits to Corey Smith and Kam Figy who told me about this.


8

Sitecore JSS is pretty match to your requirements in terms you want to use analytics, tracking, rule engine personalization, control on component rendering. But you should't think about JSS in original meaning. JSS is based on the Layout Service which is awesome tool that allows us to retrieve content from Sitecore and still be able to use all features like ...


8

You have most of the pieces you need, but not all. You need a patch config <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"> <sitecore> <initialize> <processor patch:before="processor[@type='Sitecore.Mvc.Pipelines.Loader.InitializeRoutes, Sitecore.Mvc']" type="...


7

It's Sitecore.Data.ItemUri format. You can use var itemUri = ItemUri.Parse(string itemUriString) to get ItemUri class object and then Sitecore.Data.Database.GetItem(ItemUri itemUri) to get the Item


7

Inner value: the "raw" value (as you can see in the editor) Standard value: value inherited from Standard Values of the template Fallback value: value inherited through field fallback Inherit value: value inherited from original item (cloning) Default value: (thanks Klaus) this will be the value in the "default value" field of the field's item, which you ...


7

Your problem is that the links will be generating a path, and all the links will have a path like: /newsitems/news Sitecore can only match an item there by path name, so its going to pick the first one in the list that it finds. You have 2 options: Option 1 - generate the links using the Guid of the item, this is terrible for SEO (although having ...


7

If you decompile and have a look at the Sitecore.Data.Items.ItemEditing class, in Sitecore.Kernel, you will find that all the EndEdit(bool) method does (and the relevant parts of its overload methods do) is essentially wrap the the call to ItemManager.SaveItem with an EventDisabler. Solution 1: To apply the same technique in order to make sure that your ...


7

Here is code which changes workflow state and executes actions: public static WorkflowResult ChangeStateAndExecuteActions(Item item, ID workflowStateId) { using (new EditContext(item)) { item[FieldIDs.WorkflowState] = workflowStateId.ToString(); } Item stateItem = item.Database.GetItem(workflowStateId); if (stateItem....


7

SPE is likely going to be your best lower effort approach. The book provides several examples for creating Context Menu options and prompting for input. Creating New-Item allows for the creation of items at a path using the specified template. Copying Copy-Item will be the go-to command for copying items. Call it for each destination. Perhaps not needed ...


7

The scheduled task is going to be a tool used to execute code you've written. There are ways to create custom commands in C# or use the existing on that is included with Sitecore PowerShell Extensions (SPE). For simplicity, I'll show you how to do that in SPE. Here's a really good section in the book covering the creating of task scripts. Examples In this ...


7

The ShutdownGuard prevents the application from shutting down, primarily this was meant to be used by the package installer to prevent the application from shutting down due to config files and dll's being deployed. Without this in place, the application would potentially restart several times during the package installation process, once each time a config ...


6

While both answers so far will work. I believe it would be far simpler to setup the email as a "campaign" style page on the site. Most emails that contain html should have a "cannot view this page? click here to view in a browser" link anyway, so this could serve as that page. Then it would be a simple WebClient to get the html and insert into the body of ...


6

For those scenario's I always use a custom field and the reason is rather simple: if your article gets an update (can be for something stupid like a typo) the ootb publish date will change but you probably don't want that effect in your sorting. Well, that's my experience - they (customers) mostly want the original publish date.. It's a choice between ...


6

No, there is no option to get all the descendants with a simple Glass Mapper attribute. You could use SitecoreQuery attribute in theory: [SitecoreQuery(".//*")] I'm not saying that getting all descendants is always wrong, but you really need to be careful when you want to use descendants. I guess that's the reason why it's not there as one of the Glass ...


Only top voted, non community-wiki answers of a minimum length are eligible