output
stringlengths 34
25.7k
| instruction
stringlengths 81
31k
| input
stringclasses 1
value |
---|---|---|
You are correct. The master database contains all versions of any given item per language.
In normal senario and before sitecore 8.1, The web database only contains a single version of each item, per language.
But, from sitecore 8.1 onwards, there is a scenario where multiple versions of a single item can exist.
i.e.
when item have an Active Test running for different versions of the same language of that item
https://sitecorefootsteps.blogspot.com/2015/10/multiple-versions-of-item-in-web.html
| Can the web database contain multiple versions of a single item?
I know that master database contains all the versions of an item.
Does the web database also contain all the versions of an item?
Or web database can only contain a single version of an item?
| |
Have you checked out the custom search provider for Algolia here?
| How can I use a 3rd party search appliance to build my searches?
I'd like to use Algolia (a cloud-based search provider) for building my search indexes instead of using SOLR. Is that possible? How could I get started?
| |
I think the media framework integration guide will get you what you need.
https://sdn.sitecore.net/upload/sdn5/products/sitecore%20media%20framework/21/sitecore_media_framework_2_1_integration_guide-usletter.pdf
It covers media import, export & synchronization
| How can I write my own Media Framework Extension?
I've noticed that Ooyala and Brightcove both have their own media connectors. I'm looking at using a different media provider, and am trying to figure out what the amount of effort would be to write my own provider. Where are the extension points that I can use to create my own login and data retrieval methods?
| |
As far as I know, I can say no there isn't at this point. Please correct me if I am wrong someone. However you can do the following to deploy sitecore items.
Source: https://github.com/kamsar/Unicorn
Automated Deployment
With Unicorn you've got two options for automated deployment of item changes, for example from a Continuous Integration server or production deploy scripts.
Use Transparent Sync
When using Transparent Sync, the items on disk magically appear in Sitecore without syncing. So one automated deployment option is to simply use Transparent Sync and copy your updated serialized items to the deployment target alongside your code. This is advantageous because it's simple to set up and requires no direct intervention with the deployed server after deployment (e.g. a HTTP call).
Use the Automated Tool API
Unicorn has an automated tool API whereby you can invoke actions in the Unicorn control panel from a script, such as invoking a sync after a code deployment.
NOTE: Automated Tool API is completely overhauled in Unicorn 3.1, and these instructions are for 3.1 only
Tools are authenticated using a shared secret between the tool and the Sitecore server running Unicorn, which is relayed via CHAP+HMAC-SHA512. The practical upshot of this is that the shared secret never travels over the wire, the authentication key is unique every time, and replay attacks are not possible. You should still use the tool API over a TLS connection if possible.
Calls to the control panel from an automated tool behave a little differently from interactive control panel sessions. Specifically:
Automated calls are not streaming (nothing is written to the response until everything is complete)
Automated calls return HTTP 500 if an error occurs (interactive calls that fail return HTTP 200, because the HTTP headers have been sent long before the error occurs). In the example PS script above, this will throw a PowerShell exception.
The output is text formatted, instead of HTML formatted, so it is much easier to read in logs.
Ok, ok. Shut up about crypto and tell me how to set it up.
Generate a very long random shared secret key, preferably using a password generator. There are no limits on character count, character types, etc but it must be > 30 characters.
Install the shared secret into the Unicorn.UI.config file - or a patch thereof, under the authenticationProvider/SharedSecret node. There are comments to help.
To call the tool API from a script, a PowerShell module is provided. Acquire the module and its supporting files from the doc\PowerShell Remote Scripting folder of the Unicorn git repository.
Review the sample.ps1 file and adapt it to your needs, including putting the shared secret into it and setting the URL as needed. Don't worry the guts of sample.ps1 are two simple lines of code :)
NOTE: When deploying to a Content Editing or Content Delivery server, the Unicorn configuration should be trimmed down from development. Each config file in App_Config/Include/Unicorn has comments at the top designating what environment(s) it should live on. If you opt to use Transparent Sync as a deployment mechanism, make sure you do not disable the data provider config file.
Darren Guy has written a practical dissertation on his experiences setting up Unicorn 3 with TeamCity and Octopus Deploy that goes all the way from install to automated deployment. A recommended read if you're wanting to use a similar setup.
Andrew Lansdowne has also written a post (for version 1, so some of it is outdated but the concepts still apply) about setting up Unicorn with TeamCity and WebDeploy that may be useful when setting up automated deployments.
| Packaging up items from Unicorn into a Sitecore package
I have used TDS for most of my packages for deployment or creating modules for co-workers and friends. TDS is great at creating update packages. Is there a process to take all Unicorn items and convert them into a Sitecore package?
| |
Turns out the guys over at SPE though through some of this too. Hopefully others find this answer helpful.
Here's a page describing how to manage item languages.
Example: The following will query all the items under home and add copy US english to CA english; skips if the language already exists.
$root = "master:\content\home"
@(Get-Item -Path $root) + @(Get-ChildItem -Path $root) -Recurse |
Add-ItemLanguage -Language "en-us" -TargetLanguage "en-ca" -IfExist Skip
| Sitecore items missing language from some of the content
What is the best way to detect which items are missing a particular language version as well as add them? Is there a method to performing this in bulk?
| |
You can install Sitecore Powershell Extensions.
This module allows you to create dialogs using Powershell Scripts and create buttons which you can connect to various places in Content Editor (context menu, ribbon, etc.)
This screenshot if from one of the examples. The code underneath the dialog is used to create it.
| How to show a simple dialog like confirm/alert to the content editor without requiring a deployment?
Sitecore has provided many great ways to plug into their architecture via pipelines and configuration patches. I'm confused however how to present a simple dialog to the content editor whenever they click a button in the CE. Is there an easy way to do this without a code deployment? I guess module packages would be ok, just no downtime to the users.
| |
You can do this easily with Sitecore Powershell Extensions, just use the following script:
Get-ChildItem . -Recurse |? { $_.__Workflow -eq "" }
| Items missing workflow audit report
I'm working on a rescue project and have started to noticed that there are quite a number of items not associated with a workflow. A few of the content editors have reported that sometimes items can be published straight to production but not all.
How can I audit the solution to see what is not associated?
| |
Turns out that you have a few options.
The first option is to open up the *Portraits.config** and modify the list of pipe-delimited icons.
The second option I discovered is you can simply paste in a new url in the user manager. As seen below, I pasted in a public image url and it showed up upon refresh of the screen.
If using Sitecore PowerShell Extensions, you can update the profile portrait and desktop with the following script. Adapt to C# if you want to perform this in your own module. Looks like the wallpaper requires a local path.
$user = Get-User -Current
$user.Profile.Portrait = "https://pbs.twimg.com/profile_images/562466745340817408/_nIu8KHX.jpeg"
$user.Profile.SetCustomProperty("Wallpaper", "/sitecore/shell/themes/backgrounds/Field.jpg")
$user.Profile.Save()
The third option may be as Owen described.
| How do you customize the the profile photo in 8.2 or newer?
From the desktop I've only been able to change the background to one of the predefined images; same goes for the profile. Not finding any articles that relate specifically to those images.
| |
Turns out that the contributors to the Sitecore PowerShell Extensions module thought of everything. Bundled with the module is a script under the script module Random desktop background. The script is apparently an adaptation from a POC by John West.
There is an integration point library called LoggedIn which in essence runs this script:
$path = [Sitecore.IO.FileUtil]::MapPath([Sitecore.Configuration.Settings]::WallpapersPath)
$files = [System.IO.Directory]::GetFiles($path)
$user = Get-User -Identity $username -Authenticated
$which = (New-Object System.Random).Next($files.Length - 1)
$user.Profile.SetCustomProperty("Wallpaper", [Sitecore.IO.FileUtil]::UnmapPath($files[$which]))
$user.Profile.Save();
The script queries all of the wallpaper images then randomly assigns one to the selected user. Note that the script runs within the context of the logged in user.
Enable the sample module by checking and saving the item. These are disabled by default since they may not be the desired behavior for everyone.
The basic idea is that any script which appears below the pipeline integration will get executed. In this example, the LoggedIn pipeline executes the Random desktop background image script every time a user is logged in. You can have many modules with the LoggedIn integration point added, and each child script will get executed.
Reference
Documentation on the pipelines
| How do you create a random desktop background image like that in Windows?
I've found this article where the author describes how to upload custom images. So what I would like to do now is have it rotate randomly every few minutes.
Seems like something that would work great with the scheduled task system.
| |
Sitecore.Datalift follows the normal pattern of trying to grab the Datasourced item, falling back to Context.Item if no datasource has been set.
While I can't tell from your code exactly what is failing, the normal caveats would be:
You've not defined your datasource. If so; your code above expects Context.Item to have a template that is or inherits User Defined/MyProject/Pages/MyItem
You have defined a datasource, but it points to an invalid or non-existing item. If so, GetActionItem will always return null.
The datasource you have defined is valid, but the item pointed to is or does not inherit User Defined/MyProject/Pages/MyItem
| Sitecore Datalift returning null for actionItem
I have the following dummy controller trying to use https://github.com/cassidydotdk/Sitecore.Datalift
public class MyController : DataLiftController
{
public ActionResult Index()
{
var actionItem = GetActionItem("User Defined/MyProject/Pages/MyItem");
if (actionItem == null)
{
return new EmptyResult;
}
var viewModel = new ViewModel()
{
Title = actionItem["Title"]
};
return View("~/Views/MyView.cshtml", viewModel);
}
}
However, I always get null for actionItem. What am I doing wrong? I am expecting the actionItem to return context item unless I have datasource then return datasource. However in both instances I get null.
| |
Have a look here in the SPE book regarding the Unlock-Item command.
Example: The following will unlock the direct descendants of the home item.
Get-ChildItem -Path master:\content\home | Unlock-Item -PassThru
You should update the path to be specific to the tenant you wish to unlock. Add the -Recurse switch to the Get-ChildItem command to run through the whole tree. You may find Where-Object helpful when filtering for specific templates.
Example: The following recurses the tree, filters for a specific template, and then unlocks.
Get-ChildItem -Path master:\content\home -Recurse |
Where-Object { $_.TemplateId -eq "{ENTER_YOUR_TEMPLATE_GUID}"} |
Unlock-Item -PassThru
| Getting locked items SPE
I have a multisite Sitecore instance and I would like to get all locked items from all different sites and users and unlock them, is it possible to do this job using Sitecore Powershell Extensions?
| |
It's my understanding that if no strategies are defined, than you would be unable to rebuild the index unless you do it directly on that server via code.
Specifying a strategy calls the AddStrategy method on the index:
<strategies hint="list:AddStrategy">
<!-- NOTE: order of these is controls the execution order -->
<strategy ref="contentSearch/indexConfigurations/indexUpdateStrategies/onPublishEndAsync" />
</strategies>
For Lucene indexes, this leads to this strategy being added to a private List<IIndexUpdateStrategy> field. If none are specified, this remains empty.
This field is just used to instantiate the strategies, which in turn are responsible for setting up the hooks, etc. they require for that index. There is no public Strategies property on the Index, so in turn there is no way for other parts of Sitecore to determine if an index has no strategies and behave differently if so.
| How does Sitecore update a search index if there are no index update strategies configured?
The Sitecore docs list the available index update strategies, but there is no mention of what happens if no strategies are configured.
For example, would the index on the CD server for the following configuration ever be updated?
<index id="schoolsite" type="Sitecore.Search.Index, Sitecore.Kernel">
<param desc="name">$(id)</param>
<param desc="folder">schoolsite</param>
<Analyzer ref="search/analyzer" />
<locations hint="list:AddCrawler">
<web type="Sitecore.Search.Crawlers.DatabaseCrawler,Sitecore.Kernel">
<Database>web</Database>
<Root>/sitecore/content/schoolsite/Units</Root>
<include hint="list:IncludeTemplate">
<unit>{E711EF29-1031-461D-B7F0-18524F255EC4}</unit>
<pdf>{2136F1FC-D871-43B8-85B1-2698DEF505E5}</pdf>
<video>{D9B5C725-51E4-4A0F-A709-3D7514BE6BB1}</video>
<infographic>{7902B359-EF49-4BE1-9121-8E70596282BC}</infographic>
</include>
<Boost>2.0</Boost>
</web>
</locations>
</index>
| |
This will require customization. Luckily for you, Kam has an example available at http://kamsar.net/index.php/2015/05/A-Multiple-Root-Treelist-Field/
This should do the trick.
| How do I define multiple sources in the Source of a Treelist field?
I am trying to add multiple root folders to the source field of a treelist template field. For example:
Datasource=/sitecore/media library/ | /sitecore/content/
I have done this with sitecore query, but treelist does not use sitecore query. This is for Sitecore 7.1
| |
An important note to start: the "Links Database" is a table named "Links" that lives inside a Sitecore database. It is not a separate database.
Sitecore only updates the Link Database on the database referenced by the CM server. The Sitecore Scaling Guide (section 3.6.1) states it as follows:
In a multi-server Sitecore setup, the link database is only
automatically updated for databases that are referenced from the CM
environment.
This client is using the Sitecore Azure module to host, manage, and deploy to its production servers in Azure, including the Sitecore databases. This means that the web roles (where the production CD servers live) have their own versions of every database. This image from the Scaling Guide (section 3.2.1) shows an example of this architecture (without Azure, but accurate enough):
The CD server was looking to its core database, while the CM server was only updating the "on prem" core database. This is why the Links table on the CD's core database was empty. This also explains why we don't see this sort of problem in many of our production environments (usually our CD servers point to the same core database as the CM servers).
Additionally, a site could have the above problem, with CD servers not having access to a built Links database, and have no problems. Much of the standard code we write for Sitecore doesn't need to use the Link database at all.
Again, from the scaling guide:
To ensure that Sitecore automatically updates the link database in the
CD environment: The CD and CM instances must use the same name to
refer to the publishing target database across the environments
(typically Web). One of the following conditions should be met: The
Core database should be shared or replicated between the CM and CD
instances. The Link database data should be configured to be stored in
a database which is shared between CM and CD publishing target
database (typically Web).
| How does Sitecore update the Link Database?
I installed the Sitecore URL Rewrite Module for a client. The module worked properly in non-production environments. However, it did not work on production CD servers. The module uses the links database to precache the rewrite rules that live as Sitecore items*.
* The module properly adds the rules to the cache when the items are republished, but this attempting to resolve the problem with an automated publish on every app pool recycle is a hack at best.
I checked the Links table on the production CM core database. I checked the configuration to ensure that the CD servers were using the core database:
<!-- LINK DATABASE -->
<LinkDatabase type="Sitecore.Data.$(database).$(database)LinkDatabase,
Sitecore.Kernel">
<param connectionStringName="core" />
</LinkDatabase>
The core database was empty! I know Sitecore maintains separate Link databases for different databases, so why is the table empty?
| |
I'd like to add that Mobile SDK for Xamarin with Sitecore Services Client support have been released.
Available as usual on dev.sitecore.net, Nuget, Xamarin Store, Github.
| Does Sitecore support xamarin mobile app development
Does sitecore has mobile api for Xamarin forms mobile app development ?
If yes, please provide links to the resources.
| |
In previous versions, Sitecore would not prevent editors from creating items with duplicate names under the same parent.
The item name is used in the path to resolve the Sitecore item (e.g. based on request URL). If multiple items with the same name exist, Sitecore will resolve one at random.
By setting the AllowDuplicateItemNamesOnSameLevel setting to false, Sitecore will prevent creation of items with dublicate names in the same level.
| what is the usage of AllowDuplicateItemNamesOnSameLevel setting in sitecore 8.1. update 2
Sitecore 8.1 Update-2 has introduced a new setting called AllowDuplicateItemNamesOnSameLevel
What is the usaged of this setting ?
| |
I wrote a blog post on this a while ago: http://www.flux-digital.com/blog/refreshing-experience-page-editor-after-using-edit-frames-or-buttons/
One word of caution though, we did see some odd issues caused by this firing and causing a save on components where it wasn't needed. So I'd suggest perhaps checking your templates(s) before firing the save, something like the following (not tested):
if (item != null)
{
if(item.TemplateID == MyTemplateIds.MyBannerTemplate.ID){
item.Editing.BeginEdit();
item.Fields[fieldInfo.FieldID.ToString()].Value = str1;
item.Editing.EndEdit();
}
}
I'll update the blog post at some point to include info on this but Let me know if you find a better way of doing this or if this works for you.
| Experience Editor changes force refresh
When in Experience Editor making changes to some fields, such as a multilist that could control a rendering of items to show, do not reflect on the page until it is saved. This can be confusing and cumbersome for content editors.
Is there a way to force a save and refresh when editing these items in Experience Editor to make the content editing experience better?
| |
I'm not aware of an official listing, but www.sitecoreug.org looks pretty complete. You can also search on www.Meetup.com, where most user groups are listed.
| Sitecore User Group Directory
Around the world, there are lot of Sitecore User Groups created/maintained/organized by sitecore community.
What is the website which contains all the Sitecore User Groups listed in same place ?
| |
The path to the root item of the site in terms of Sitecore content tree. For example, it is set to /sitecore/content for the “website” site.
See Documentation
| Usage of rootPath property of Site configuration node
In the sitecore configuration, we use site configuration nodes to define websites.
In that configuration node, there is rootPath property with values to sitecore content item.
What is the usage of this rootPath setting?
| |
There is a Modules Compatibility Table on Sitecore's knowledge base site: https://kb.sitecore.net/articles/541788.
| What is the place to view Sitecore module compatibilities
Sitecore comes with lot of official modules. These modules has there own versions while core Sitecore CMS has its own version.
What is the best place to view all these modules and there compatibilities with Sitecore CMS versions ?
| |
In order to gain access to the Sitecore support site you need to be a Sitecore certified developer. There are both instructor lead classroom and eLearning options available.
You can learn more from Sitecore Training about the available classes and options.
At the end of the training class there will be a certification exam. Once you pass the exam you will have access to the Sitecore support site.
| How to get Sitecore Official Support help
Sitecore has there own Official Support process where we can create tickets/issues and get help from them.
i.e. http://support.sitecore.net
What is the criteria to be eligible to create tickets/issues to Official Sitecore Support ?
| |
Sitecore 8.2 has a new admin page at /sitecore/admin/SupportPackage.aspx that will gather this information into a zip package for you. For earlier versions, you can use the Support Package Generator, which is a windows GUI application that helps you generate the package.
| How to generate information needed for Sitecore support when creating a ticket
When contacting Sitecore official support, they are requesting some basic information about our solution.
What is the best and easy way to create these information ?
What tools/modules can we used to generate these info ?
| |
There is no user interface that would show you the package installation history out of the box, but seeing it is pretty easy. Sitecore stores information about installed packages in the Core databases under the following path:
/sitecore/system/packages/installation history
If you want to know more details about this, read the following blog post:
http://kirkegaard-at.blogspot.bg/2013/10/sitecore-package-installation-history.html
There's also a Sitecore module on the marketplace that provides a UI for package installation history:
https://marketplace.sitecore.net/en/Modules/PackageHistory.aspx
| Is there anyway to find packages installed into Sitecore instance
In Sitecore, there is a facility to install Sitecore packages.
Is there a way to view what packages are installed into our Sitecore instance and when they got installed ?
Are there any modules to support this functionality ?
| |
Running your website in "Live Mode", means you serve content from your master database.
This is a broadly applied practice in a distributed environment, to have your CM instance function as a QA website. In this way, your content editors can review their changes on the website, before publishing to the live site on the CD instance.
http://www.verndale.com/insights/blog/2012/october/sitecore-live-mode/
| What is Sitecore Live Mode?
Sitecore CMS normally uses web database content to display in fornt-end website.
What is the way to run Sitecore front-end website pointing to master database.
Does that mean running Sitecore Live Mode ?
| |
The settings are: database=master, filterItems=true and enableWorflow=true.
There is an example patch file included in App_Config/Include named LiveMode.config.example.
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<sites>
<site name="website">
<patch:attribute name="database">master</patch:attribute>
<patch:attribute name="filterItems">true</patch:attribute>
<patch:attribute name="enableWorkflow">true</patch:attribute>
</site>
</sites>
</sitecore>
</configuration>
Match the site name ('website' in this example') to the corresponding site name to enable Live Mode for. You can rename the included LiveMode.config.example file to LiveMode.config to enable the patch or make the changes to the site node definition for your local development environment.
| How to run Sitecore in Live Mode?
I need to run my front-end website by pointing to master database, temporarily.
What settings should I change to achieve this?
| |
from sitecore 6.5
setting name="WebEdit.PlaceholdersEditableWithoutSettings"
value="false"
if needs to use dynamic placeholders or need to edit a placeholder without setting placeholder settings prior, then set this setting to "true".
| How to make Experience Editor placeholders editable without placeholder settings?
Normally, we need to define placeholders with allowed renderings in placeholder settings, to allow Experience Editor to support.
What is the way to configure placeholders editable in the Experience Editor if placeholder settings are not specified ?
| |
If you have access to the file system for the instance, you can look at /sitecore/shell/sitecore.version.xml. Otherwise, you can log into desktop mode and from the start menu, go to All Applications > System > License Details.
Also sitecore output the sitecore version to new error log files.
| What are the ways to find the Sitecore version on Sitecore installations?
For the existing Sitecore instances, what are the different ways to find the version of the Sitecore CMS ?
| |
xDB online visits, in most cases, map one-to-one to ASP.NET sessions. Generally, ASP.NET sessions are tracked in the browser using the cookie ASP.NET_SessionId, and the actual visit state (including the InteractionId) is kept in the session store you've configured in Sitecore.
The reason I said "in most cases" in the sentence above is because there are cases when xDB contacts and live sessions are merged. For example, if a person opens a Sitecore website on two devices at the same time and then authenticates on both (resulting in a call to Session.Identify()), the two previously anonymous contacts, along with their currently running visits, will be merged together. Hence, multiple ASP.NET sessions may sometimes end up as a single interaction in xDB.
| How does xDB track individual visits?
With Sitecore 8.x, there is no longer a cookie associated with the individual visit (though of course the visitor cookie, SC_GLOBAL_ANALYTICS_COOKIE is still there). How does xDB track individual visits? Is there a browser-stored entity that corresponds to the Interaction ID, or is this purely managed on the server side, i.e. requests coming from a specific visitor cookie are considered to be one interaction while the server session lasts?
| |
The Sitecore 6.6 scaling guide has this to say about the IDTable:
You can store persistent mappings of arbitrary keys to Sitecore IDs in the Sitecore IDTable.
By default, this is only used by the Sitecore CMS WebDAV functionality to keep locks on media items in the CM environment and does not need to be synchronized with the CD environment.
You configure the location of the IDTable in the web.config file in the IDTable section in the connectionStringName parameter:
<IDTable type="Sitecore.Data.$(database).$(database)IDTable, Sitecore.Kernel" singleInstance="true">
<param connectionStringName="master" />
<param desc="cacheSize">500KB</param>
</IDTable>
To synchronize the contents of the IDTable between the CM and CD environments, change the connectionStringName parameter in the IDTable configuration section to point to a Core database that is shared or replicated between the environments. Alternatively, it can point to a shared Web database.
There is also this page documenting the table and its API in more detail:
http://sitecore-community.github.io/docs/documentation/Sitecore%20Fundamentals/Data%20Providers/Implementing%20a%20Data%20Provider/Mapping%20Identifiers/
So you can use this table to map any string key to an ID. An example scenario would be importing items from an external system and tracking the imported item IDs to avoid duplicates.
| What is Sitecore IDTable usage?
There is a table called IDTable that comes by default with Sitecore installations.
What is the usage of this table ?
| |
For Sitecore 8.1 and later:
Per Sitecore documentation, you can run in "CMS-only" mode:
To run CMS-only mode, you must set the Xdb.Enabled configuration setting to false in the Sitecore.Xdb.config configuration file.
https://doc.sitecore.net/sitecore_experience_platform/setting_up__maintaining/experience_management/experience_management_an_overview
For Sitecore 8.0:
There is a knowledge base article describing how to run Sitecore 8.0 without MongodDB, listing these steps:
Configuration Instructions To Disable XDB
Step 1: Disable analytics:
Go to /App_Config/Include/Sitecore.Analytics.config and set Analytics.Enabled to false:
<setting name="Analytics.Enabled" value="false" />
Step 2: Comment out analytics related connection strings:
Go to /App_Config/ConnectionStrings.config and comment out, or remove, the following connection strings:
<add name="analytics" connectionString="mongodb://localhost/analytics" />
<add name="tracking.live" connectionString="mongodb://localhost/tracking_live" />
<add name="tracking.history" connectionString="mongodb://localhost/tracking_history" />
<add name="tracking.contact" connectionString="mongodb://localhost/tracking_contact" />
<add name="reporting" connectionString="user id=user;password=password;Data Source=(server);Database=Sitecore_Analytics" />
The process is not as clean (for example, the system writes error messages to the log), and the KB article documents how Sitecore functionality is impacted.
| How can I disable xDB?
If I don't have a working connection to MongoDB and I don't want to use xDB functionality. Currently, my logs are being filled with errors.
What is the configuration needed to disable xDB?
| |
To my knowledge, Sitecore/Komfo doesn't offer developer accounts yet. If you're aligned with a Sitecore Partner, the partner can get an account from their partner rep. That's how we got ours.
| Developer access to Komfo
Beginning with Sitecore 8.0, the Social Connected module became part of the main platform, and it now requires access to the third-party Komfo service. When a user clicks on the Social button on the Sitecore Dashboard, she is prompted to log on to Komfo, either with a Komfo account or with Google/Facebook.
I attempted to log in with both of these social services, but received this message: "You don't have access to our platform with the following accounts." There is no way to create a Komfo account; the only option presented is to "request a demo".
Is there a way to obtain a developer account? This is a significant barrier to developer discovery.
| |
Branching off of @SzymonKuzniak's answer, the simple answer is "no" but the complex answer is "yes, with some trickery, by tapping into the getLookupSourceItems pipeline."
In order to minimize development cost and maximize your extensibility, maintainability, and reusability, my recommendation would be to write a processor for the getLookupSourceItems pipeline that executes "Source Query" (the name I would give to the Rule Context Folder) rules.
Benefits:
You can create macros for common query patterns (e.g. Site Home, Site Globals, etc.)
You can create far more powerful filters than those provided OOTB
You can use conditions to make the rules template specific, or to make them apply to a template and all inherited templates
Low implementation effort, with high extensibility, maintainability and flexibility
Words of caution:
Don't make rules that filter the source based on the value of a field on the item (or even another item). If a change is made to the dependant field, the content author would need to save the item before the source filtering gets updated. Remember that a content author could have more than one window open too.
If you make rules that affect an item template and all inherited templates than any "overriding rules" must come after the initial rule, or the condition will need to be updated in the original rule to exclude the specific inherited template(s).
| Override the source of a template field
If I have a template that is inheriting a field from a base template, Is there any way to override the source of that field?
| |
The page editor (a.k.a Experience Editor) is used to edit content, so it uses the master database.
| Does Page Editor run on master or web database?
If I open a Sitecore content item in Sitecore Page Editor, does it run on the master database or on web database?
| |
Your root item (probably a real Sitecore item) has to be set as a bucket. For your child items (the virtual ones from your provider), you need to set the Is Bucketable value to true on the 'Standard Values' of the template (so not on the template itself).
Definitively read this https://stackoverflow.com/questions/36692431/display-items-in-bucket-with-sitecore-data-provider as well as it covers your question.
| Custom Data Provider with bucketed items
I am creating a custom data provider to integration news articles from an external API into a Sitecore solution.
The external data source has a large amount of news articles though, so I would like to bucket the items in the Sitecore content tree.
How would I achieve this?
| |
Sitecore Commerce Connect employs a similar approach. From the Commerce Connect Integration Guide:
3.1.5 ID Mapping By design, the remote product repository is always regarded as the main repository, which by default owns the products.
That makes the ID of the products and artifacts in the external system
the primary key.
In Sitecore, the IDs of the corresponding items for
products and artifacts are generated by Connect instead of relying on
the default Sitecore implementation that automatically generates a new
GUID for each new item created.
By using a hash algorithm, it is
possible to generate a direct mapping between the IDs coming from the
external system and the item IDs in Sitecore. It has the following
benefits:
No need for mapping tables taking up space.
It becomes very fast to get the ID of the corresponding item.
There is no need for searching for the items in Sitecore if the external ID is provided.
The default implementation is based on the MD5 hash
algorithm and has the following format:
Item.ID = MD5.ComputeHash(Prefix + ExternalID);
So essentially; make a Sitecore ID based on prefix (which would be your entity type; "product", "category", "customer" and so on) and the foreign unique key of the entity. That should bring you to the same ID result every time.
| Consistent GUIDs for custom data provider
I am creating a custom data provider to integration news articles from an external API into a Sitecore solution.
The external data source use simple integers as ID for the news articles though.
I will be running the data provider in "live mode" (directly in both master and web databases without publishing). How do i generate consistent GUIDs from the ID, so that the GUID will be the same across both databases?
| |
In addition to the description provided in Szymon's answer, you can use physicalFolder and virtualFolder to define part of your website url.
i.e. hostname/virtualFolder/item_path
We have used this senario in complex multi-site implementation, instead of language property. We used virtualFolder & physicalFolder to define our language portion of the url.
| What is the usage of "physicalFolder" and "virtualFolder" attributes in a Sitecore site defintion
<site name="xxx" inherits="website" hostName="xxx.local"
virtualFolder="/"
physicalFolder="/"
targetHostName="xxx.local"
scheme="https"
rootPath="/sitecore/content/xxx"
startItem="/Home"
database="master"
domain="xxx"
enableContextualLinks="true"
enableItemLanguageFallback="true" />
The site section of the Sitecore configuration file, what is the usage of the following settings -
inherits
virtualFolder
physicalFolder
| |
I've only ever seen one example of completely automating this process, based off the original Sitecore spreadsheet. It only works off the original; so you would need to expand it for Unicorn and other tools in use.
It relies on PowerShell. (not Sitecore PowerShell Extensions).
Essentially the script functions like this:
Export the sheet into CSV format
Read and parse it with PowerShell
Renames config files to .config/.config.disabled as appropriate
See the Gist from Michael West here. Sitecore Role Configurator.ps1.
Main script reads like this:
<#
.SYNOPSIS
The following script prompts the user for a Sitecore server role, then applies the appropriate configurations as specified by the spreadsheet.
.NOTES
Michael West
2016-06-17
#>
$VerbosePreference = "Silentlycontinue"
$configOptions = Import-Csv -Path C:\temp\Config_Enable-Disable_Sitecore_8.1_upd3.csv
$role = Read-Host -Prompt "Which server role would you like to use? (i.e. CD, CM, CMP, PRC, RPT)"
$apppath = "C:\temp\"
foreach($option in $configOptions) {
$configPath = Join-Path -Path $apppath -ChildPath $option.Filepath
switch($option.$role) {
"Enable" {
Write-Host "Enabling $($option.Filename)"
$oldConfigPath = Join-Path -Path $configPath -ChildPath ($option.Filename + "*")
$newConfigPath = Join-Path -Path $configPath -ChildPath $option.Filename
}
"Disable" {
Write-Host "Disabling $($option.Filename)"
$oldConfigPath = Join-Path -Path $configPath -ChildPath ($option.Filename + "*")
$newConfigPath = Join-Path -Path $configPath -ChildPath $option.Filename.disabled
}
default {
continue
}
}
if(-not (Test-Path -Path $oldConfigPath)) {
Write-Verbose "Skipping $($oldConfigPath) because the path does not exist."
continue
}
Move-Item -Path $oldConfigPath -Destination $newConfigPath
}
| Automating server role configuration
When configuring server instances in a distributed environment, a range of config files must be enabled or disabled based on the instance role (e.g. CD, CM, Processing, Aggregation), referencing the "Config Enable Disable Excel spreadsheet":
https://doc.sitecore.net//~/media/F50C507B9BC04FEB9C9D933433A9C3C3.ashx?la=en
On top of the default configs I need to handle configs from 3rd party tools such as Unicorn and Synthesis (I can create a corresponding spreadsheet for each of this).
I would like to automate this process as a step in my continuous integration setup. Does anyone have any experience on this?
Note that each instance in the environment can have multiple roles (CM, Processing, Aggregation combined etc).
Update
In the current setup we are using TeamCity to build and deploy the solution. I am looking for a general solution though (e.g. a powershell script), since the setup varies across customers (TeamCity, Jenkins, Octopus, TFS etc.).
| |
It depends somewhat on the modules you're running (and version of Sitecore) and the traffic of your site.
For instance - there is specific guidance around when a dedicated server is needed for EXM (A dedicated server is recommended at 100k+ emails per week): https://doc.sitecore.net/email_experience_manager/configuring_the_delivery_process/dedicated_email_dispatch_server/dedicated_email_dispatch_servers
For xDB - I couldn't find documentation - but in meetings with Sitecore, they've mentioned that more than 1 million interactions per month requires a dedicated Processing Server.
For scale - one of the first things that ends up being broken out is Content Delivery. Your CM server is typically less utilized and can then take on roles like processing, EXM dispatch, etc.
Sitecore licenses are just too expensive to dedicate a server to every role.
| Is a multi-role Sitecore server ok in production?
The architecture guidance from Sitecore suggests that multi-role servers - e.g. combining Content Management / Processing / Reporting - should only be done in development and not in production.
However, I've now seen many installations that are only splitting Content Delivery roles out onto their own servers. Often Processing + Reporting are also running on a single Content Management server.
These sites weren't falling over, but perhaps their traffic was just low enough for it not to be a problem. Does anyone have experience of a definite limit they were able to see, that meant running these multi-role servers was just not viable?
| |
Here's an overview of each of the publishing methods:
Republish
This publish will simply fully publish out each item again, regardless of whether it has been published before or not. Therefore this is the slowest publish as Sitecore will still transfer over changes that may already be on the target database.
Smart
With this method, Sitecore will look at each item and compare it to the item in the target database (if it exists). If it determines that it needs to be updated, then it publishes the item, otherwise it skips it. I'm not actually sure what method it uses to determine if it needs to be updated, but my guess would be that it uses the Revision field which is a GUID that is updated each time an item is updated. If the GUIDs match, it would know that it doesn't need to update the item. Of course, if the item isn't there at all, it will be published.
Incremental
Every time an update is made to an item, Sitecore tracks this change inside the PublishQueue table in the database. This is effectively Sitecore recording the fact that this item has changed, and therefore will need to be published. When you do an Incremental publish, this table is simply read to get the list of items that need to be published out. After the publish, this table is cleared.
Incremental is the fastest method of publishing as Sitecore is only publishing out what has changed. However it is also prone to error, for example if the PublishQueue table has been cleared before those items have been published, then an incremental publish won't publish those items.
| What is the difference between republish, smart publish and incremental publishes?
Does anyone know what the difference between the 3 main types of publishing in Sitecore are?
I have the option to do a republish, incremental publish and a smart publish
My understanding is that a republish will publish everything but I don't understand the incremental or smart options
| |
I agree that this is many questions in one. As a start though this is from the Sitecore 6.3 PDF:
Event Queues
To ensure data and cache coherence and support communication between instances in an environment and between CM and CD environments, Sitecore CMS 6.3 maintains event queues as tables in Sitecore databases. Each Sitecore instance accesses one Database Event Queue for each database, and writes database events relevant to the containing database to each queue. Each instance designates one of the Database Event Queues as the System Event Queue, and additionally writes system events to that queue. The System Event Queue contains events related to security, publishing, and other operations. By default, Sitecore manages the System Event Queue in the Core database. Unless
directed otherwise, each instance processes database and system events in all database queues.
More info here: https://sdn.sitecore.net/upload/sitecore6/63/introducing_sitecore_cms_6.3_a4.pdf
There is also some great info on how to enable this and how it works here:
https://sitecorebasics.wordpress.com/2011/03/19/basics-of-sitecore-event-queue/
| How does the Sitecore event queue work?
There's an EventQueue table in every Sitecore database. It contains both the local and remote events of Sitecore instances.
I would like to know how the event queue works, exactly.
Why are some events stored in the Core, some in the Master, and some in the Web database?
Why is there a need to track local events? Can't they just be handled internally in the instance that fired them?
How does Sitecore know that a remote event has been fully processed by all instances?
When is it safe to remove an EventQueue record from the table?
| |
You are able to change the format of the default bucketing folder structure uising the following setting:
<setting name="BucketConfiguration.BucketFolderPath" value="yyyy\/MM\/dd\/HH\/mm"/>
Note that this is still based on the item creation date though.
It is also possible to utilise the Sitecore Rules Engine to determine the folder structure, updating the rules on /sitecore/system/Settings/Buckets/Item Buckets Settings in the content tree.
Out of the box the following rules are available:
The first rule is pretty much the same as the default naming using config settings, but it does allow you to set a different format per bucket folder. The other 2 rules use the item ID or name and then create nested folders based on that.
If none of rules meet your requirements then it is possible to create a custom rule and utlise that instead. For example, to create the folder based on the user creating the item and the year you could use:
public class UserBasedPath<T> : RuleAction where T : BucketingRuleContext
{
public override void Apply(T ruleContext)
{
if (Sitecore.Context.Data != null && Sitecore.Context.Data.User != null)
{
ruleContext.ResolvedPath =
Sitecore.Context.Data.User.LocalName + "/" + DateTime.Now.Year;
}
}
}
You will need to register the rule under /sitecore/system/Settings/Rules/Definitions/Elements/Bucketing and set the Text and Type fields to match your rules and the it will be available for use in the Rule Set Editor.
| Can bucketing strategy be controlled per template?
Bucketing is a nice feature for organizing a large amount of items in the Sitecore content tree, however the default bucketing strategy based on item creation date is mostly useful for content where the creation date is actually relevant (e.g. news articles).
Can multiple bucketing strategies co-exist in the same Sitecore solution? Is it possible to create a different bucketing strategy based on the bucket item template?
| |
You just need to go to each of your templates' field items and add a Long description and Short description as per the image below. Save this and go to a component and your help text will show to content editors:
| How to add helpful text to a Sitecore field
In other peoples Sitecore installations, I have seen fields with a bit of descriptive text next to the field name to help the user input the correct information.
I would like to use this in my current installation, but I don't know how to add this helpful text to a field name.
| |
Prefetch cache
This is item data pulled out from the database when the site starts up - from the Sitecore docs:
"Each database prefetch cache entry represents an item in a database. Database prefetch cache
entries include all field values for all versions of that item, and information about the parent and
children of the item.
Populating the prefetch cache results in smoother user experiences immediately after application
restarts. Excessive use of prefetch caches can affect the time required for application initialization."
Data cache
This cache is to minimise the round trips to the database, it again pulls item information from Sitecore but the difference being it does it when the item is requested (rather than start-up of the site); it will pull the data from the pre-fetch cache if it's there or go back to the database if not.
Item cache
This cache has objects of type Sitecore.Data.Items.Item which would be used in code; when an item is requested in code it will look in the Item cache, then back up the data cache and up again to pre fetch cache and finally to the database.
HTML cache
This output caches the HTML from sublayouts and renderings, there are a nice level of configuration to only cache the HTML based on querystrings, different data etc.
Flow of cache
The following is taken from http://web.archive.org/web/20181023070800/http://learnsitecore.cmsuniverse.net/Developers/Articles/2009/07/CachingOverview.aspx
References
Some of these references are a bit old, but I don't believe this part of Sitecore has changed that much over the years.
http://learnsitecore.cmsuniverse.net/Developers/Articles/2009/07/CachingOverview.aspx
http://sitecoreblog.patelyogesh.in/2013/06/how-sitecore-caching-work.html
https://sdn.sitecore.net/upload/sitecore6/66/cache_configuration_reference_sc66-a4.pdf
| What is the difference between the item, prefetch and html caches?
It is my understanding that there are various different caches in Sitecore.
What are they for?
I know there is an item cache, a html cache and a prefetch cache, but I don't understand how they differ or how I can control these caches
| |
You could mark those items as hidden - regular users don't see hidden items by default (and you can disable option to show them as well)
You can set it on the item or on the template's standard values. Just search for a Hidden field in the Appearance section.
| Hiding items in the Content Editor for certain users / roles
The content editors want to divide up their roles so that some editors of the site only have access to edit and change a certain area of the site (e.g. /news and all its descendants). These editors would belong to a particular role, e.g. News Editor. They would like it to be as easy as possible for them, so in the Content Editor they would only see the pages that relate to them.
To do this I have tried using item security to remove their Read access to the other pages of the site. However now when those users try to preview the site, it doesn't look right or it breaks because renderings aren't able to read the items.
I still want them to be able to preview the site as if they were a real user, so they may still need Read access to these items for that to work. Can I just restrict their view of items in the Content Editor, but have the site still function correctly?
I am aware I can remove their Write access and they would then be prevented from editing certain items and the site would still work for them, however that does not solve this problem.
| |
You can try clearing the Links table before starting a link db rebuild.
Tasks like Erasing (or comparing) existing data might also included in the rebuilding process, which might cause this issue.
| How to speed up rebuilding the link database?
I'm rebuilding a link database with more than 10 millions of rows. It is taking 16 hours per database, but the web server and SQL server are almost idle, even when new rows are generated slowly in the links table.
Is there any way we can make use of all the resources available?
Please note this is Sitecore 6.6 Update 8.
| |
You've got a few options:
The Simple Option:
Add a width (see here: Sitecore Image Parameters) - the image sizes will be processed. The disadvantage of this approach is that you get a processing hit the first time the image is resized (it then caches the result I believe).
A more complex option:
You can build something which farms the images out to a CDN and processes the images within the CDN - you'd have to do quite a bit of heavy bespoke work to get this going but it would be pretty cool :)
An enterprise option:
You could use an external DAM to do the heavy lifting for you (something like Picturepark, Asset Bank, EDAM, DigiZuite etc).
| Optimizing Sitecore Media Items
We're currently trying to optimize our site so the end users get fast response times. One of the areas we are looking at moment is the media served from the Sitecore Media Library.
What settings are available and what techniques can be used to ensure that the media items are both optimized in terms of size?
For example, it's not uncommon for users to upload large high quality 1MB+ images, but the image may only used as a small thumbnail on a related content widget or even when used as a main image on a page, the uploaded image is much larger than the conataining HTML element.
Are there any settings available to "down size" the image for each use or should be instead ensure that the editors upload the correct size image to begin with?
| |
Yes need to have Analytics enabled for the personalization rules to be enabled in the system, but you can effectively disable it by turning off the database writes.
You need to set Analytics.Enabled to true and Analytics.DisableDatabase to true. Example patch file:
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<settings>
<setting name="Analytics.DisableDatabase">
<patch:attribute name="value">true</patch:attribute>
</setting>
<setting name="Analytics.Enabled" value="true">
<patch:attribute name="value">true</patch:attribute>
</setting>
<settings>
</sitecore>
</configuration>
With these settings, you enable the personalization rules in the presentation component, but you do not need the analytics database and no writes are attempted by Sitecore.
| Personalizing components with Analytics disabled in Sitecore 7.2
I've just come across an issue with missing personalization options on a Sitecore 7.2 website.
Analytics was recently disabled.
I found an article explaining that disabling Analytics hides all personalization rules sections.
Is there a way to personalize components with Analytics disabled?
| |
The answer to this depends on the context of your project. Sitecore's recommendations are to make incremental upgrades for every version and updates as well since your current to the latest you are trying to get upgraded to. This does require a lot of work specially when it's a big jump from 6.5 to 8.2. As already answered here if you are making manual upgrades consider the lists described here as well as upgrading modudes(make sure they are compatible with the latest version), create a separate environment just for the upgrade to run(make sure you coordinate with the client how that impacts the content editing in that time frame), you will most likely need to drop the serialized content tree from 6.5 to 8.2 and test all places where it can break. I recommend checking out these tips for upgrading as well.
| What's the best migration strategy for 6.5 to 8.2?
In a few weeks, I'll start a migration project of a Sitecore 6.5 site to an 8.2 site.
At that time the Express Migration Tool will only support 7.2 to 8.2, so the rest will be a manual process.
I still have to go over the project and code with the original developers.
I've googled around a bit for different strategies and was wondering if anyone had a better idea.
I've heard there are a lot of WFFM forms on this site, so they will be a key success factor.
upgrade preparation plan
identify the state of all environments (which version/branch of the solution is deployed where
if possible deploy latest version everywhere (preferably done with original dev)
identify custom code and which parts of Sitecore it plugs in to (together with original dev)
identify configuration coupling: which files need to be changed and which can be used as a whole (together with original dev)
set up a (manual) test plan for smoke testing site in each intermediate version
list deprecated functionalities of each intermediate version to determine code to be modified
list modules that need to be upgraded/replaced
list prerequisites for each intermediate version
choose appropriate windows and SQL server version
run a link checker before any new upgrade to check for any extra problems.
decide which errors can be ignored (but should be documented) until reaching the final version
discuss upgrade strategy with Sitecore (sharing as much info as possible from previous steps)
high-level upgrade strategy:
stop development
clear publishing and event queues. set longer timeouts in web.config
shrink and rebuild db indexes
update all environments with production content (take care not to lose not deployed development)
upgrade to version x
backup analysis and upgrade reports and logs
test, compare to x-1 and backup version x
deploy version x to staging or whatever temporary QA site
have key users verify version x on staging or whatever temporary QA site
upgrade to version x+1
... repeat until version 7.2 (or whichever version is supported by then)
use Express Migration Tool
Since it's important to spread the word, I will be blogging about this and the solution. First part can be found here
| |
To make HTML cache work:
Make sure that the cacheHtml attribute of your /configuration/sitecore/sites/site is set to true.
If you dynamically bind a rendering to a placeholder using layout details, cache settings explicitly defined in layout details will override cache settings defined in the rendering definition item. Make sure that cache settings are either set correctly in the layout details, or that they aren't set at all.
If you use Sitecore Debugger, make sure that rendering information is turned off by unchecking the "Information" checkbox in the "Rendering" group in Sitecore Debugger.
| Rendering Caches not working
I have a problem with my HTML cache always being empty when I look at the cache report screens in Sitecore I have done the following:
Enabled Cacheable and Vary By Data on each rendering in Sitecore (view renderings and controller renderings)
Ensured that under each site (this is a multisite solution) I've set cacheHtml="true" htmlCacheSize="25MB"
Set Caching.DisableCacheSizeLimits to true
Am I missing something as when I hit this page: /sitecore/admin/cache.aspx I see nothing in my HTML cache for any sites. Also /sitecore/admin/stats.aspx shows 0 in the from cache column for everything.
| |
It could be that you just have a dodgy rendering that is running on every page and is then cached for that page; to see if this is the case you can profile Sitecore pages.
You can investigate this by clicking on the "Debug" option
and scrolling to the bottom of the page to see the speed of renderings:
From here you can either optimise the code, or check out the rendering to see if you can be more aggressive with the cache on the rendering
| Sitecore Page - First request on every page slow
We have been noticing that the first request to any of the Sitecore pages seems to be loaded slow. Every subsequent request is ok.
Note that we can't use output cache as is a transaction based member portal.
What could be the cause and possible solution?
Is there any way to view what's on a pre-fetch cache?
How do we determine the right balance of configuration for pre-fetch cache?
How would prefetch cache work for a scenario where we have multiple CD at any given time (azure scale up/down)?
Background:
Sitecore 8.1 initial release
Hosted in Azure Web Apps
| |
We had a similar problem in a production installation that had a significant number of calculated Lucene fields, plus a number of very active content authors with a lot of publishing and index updating activity.
Essentially Sitecore was pushing events at Lucene faster than it could process them.
Here are some suggestions:
Try switching your index update strategies to be more batch-oriented.
Here's an example of how to do this for the master index:
Replace:
<strategy ref="contentSearch/indexConfigurations/indexUpdateStrategies/syncMaster" />
With:
<strategy ref="contentSearch/indexConfigurations/indexUpdateStrategies/intervalAsyncMaster" />
in your Website\App_Config\Include\Sitecore.ContentSearch.Lucene.Index.Master.config
Try dialing back the frequency of event queue polling
In sitecore.config modify this setting:
<eventing defaultProvider="sitecore">
<providers>
...
</providers>
<eventQueue>
<!-- Time between checking the queue for newly queued events. If new events are found they will be raised. -->
<processingInterval>00:00:02</processingInterval>
</eventQueue>
</eventing>
You can also set the index rebuild threshold to prevent Lucene from rebuilding your indexes too often, if you have a lot of activity and a large number of index entries:
<settings>
<!-- Default value is 100,000 -->
<setting name="ContentSearch.FullRebuildItemCountThreshold" value="100000" />
</settings>
This really helped us with some mysterious index syncing problems between servers. It took weeks with Sitecore Support to reach these conclusions. Hope it works for you too.
| Requests stop being served due to Lucene Deadlock
I'm currently running into an issue in production Content Delivery where every now and then (2 hours to 2 days), all requests will stop being served. Via memory dump we've been able to track down the cause as a thread deadlock - always a piece of code that is querying a Lucene index. My understanding of Lucene tells me that, it would seem unlikely that a read operation against Lucene would cause a deadlock but I'm not sure what would cause one.
| |
The out of the box links don't specify language at all, so there is no way with an internal item reference to specify a specific language. The link is tied at the item level, not the version. Similarly, you can't directly link to a specific version of the content in the current language.
When invoked, the LinkManager uses the current context language for building the URL in a Rich Text field from the internal link. If you want to override this behaviour, you'll likely have to do the following:
Add two fields on your content: one for the link, and one for the target language
Write custom logic to output the link field and use the selected target language as a parameter for the LinkManager URL options.
NOTE: If you are using display name for your URLs, you might have to load the item in the target language and pass that target item into the LinkManager as your different languages might be outputting different URLs. If you only use the Sitecore.Context.Item for the parameter you will always get the path for the current language, and not the target one.
| How to link to a different language version
I need to create a link to an item in a different version than the currently active.
Is this possible through the General Link field or the RTE Sitecore Link?
Example
I am currently viewing http://mysite/somepage. I would like to link to http://mysite/en-us/some(other)page (language is resolved through URL in this scenario).
UPDATE
The requirement is that the editor should be able to link to an item in a different language.
| |
In multi-site solutions, when you edit an item in the Experience Editor, Sitecore will by default resolve the site context using the value of the setting Preview.DefaultSite. It's located in Sitecore.config, and my guess is that you currently have it set to mysite1:
<setting name="Preview.DefaultSite" value="mysite1"></setting>
This means the default site context used by the Experience Editor will be mysite1.
You can change this behavior by setting another setting called Preview.ResolveSite to true. That will make Sitecore correctly resolve the site context of the item being edited:
<setting name="Preview.ResolveSite" value="true"></setting>
Note that on some Sitecore revisions you will need to apply the following hotfix in order for this feature to work correctly:
https://kb.sitecore.net/articles/382913
| Editing Content in Experience Editor in Multi-site configuration
We have a multi-site setup and have the following sites defined in config:
<sites>
<site name="mysite1" patch:before="*[@name='website']" rootPath="/sitecore/content/mysite1" startItem="home" hostName="mysite1.com" ... />
<site name="mysite2" patch:after="*[@name='mysite1']" rootPath="/sitecore/content/mysite2" startItem="home" hostName="mysite2.com" ... />
</sites>
When content editors log in to the admin interface (mysite1.com/sitecore), they are able to see all the content in the tree for both sites, due to the way the roles and permissions are set up. Some users are in multiple roles and therefore can see content for multiple sites. The problem, however, is when a user tries to edit content using the Experience Editor—for mysite2, some elements of the site still refer to the logged-in site, e.g. mysite1.
Investigating further, it seems that Sitecore.Context.Site is set to "mysite1" in the Experience Editor.
What is the best way to allow the user to edit both sites separately in the Experience Editor?
| |
This bug is referenced in the knowledge base as Reference number: 88491.
Specifically, it patches the majority of the <sitecore.experienceeditor.speak.requests> pipeline and takes care to ensure that requests to the SPEAK which are generally handled over AJAX calls are properly formatted.
It should be noted that this is an issue specifically with Sitecore Experience Editor and NOT EXM specifically. However, it's easy to blame EXM due to the tight integration that Experience Editor has inside of the Email eXperience Manager
The fix itself has been fixed in Sitecore 8.2, however EXM 3.4 (which supports Sitecore 8.2) isn't released yet of the writing of this response.
There is NOT an actual kb.sitecore.net article on this issue.
| Broken external links encoding
There's an issue in our EXM when referring to external links. When we insert these links in EXM message editor:
http://www.huffingtonpost.com/2014/05/23/rock-climbing-cat_n_5380069.html?utm_hp_ref=adventure&hq_e=el&hq_m=4435336&hq_l=15&hq_v=1adccf5361
The delivered email then contains only <a> tag with no href.
Also, you get a 500 error in the message editor when trying to edit the link again and you can't edit it anymore.
There's a message in the logs I believe is related to this:
> 6688 13:22:30 ERROR Attempted to load invalid xml. Exception:
> System.Xml.XmlException Message: '=' is an unexpected token. The
> expected token is ';'. Line 1, position 94.
We found a workaround where we encode the URLs like this:
http://www.huffingtonpost.com/2014/05/23/rock-climbing-cat_n_5380069.html%3Futm_hp_ref%3Dadventure%26hq_e%3Del%26hq_m%3D4435336%26hq_l%3D15%26hq_v%3D1adccf5361
then it works as expected.
Any thoughts?
| |
Your Sitecore application should never use the same Data folder.
If they do, they will override their indexes every time while index is rebuilt.
I'm guessing that's exactly what's happening in your scenario - one application tries to update its index and another one tries to perform another operation on index files in the same moment. It's not supported.
Your indexes should be kept in separate location for every Sitecore application.
| Sitecore 7.1 IIS workers fighting with each other
Has anyone had an issue that you have multiple worker processes under application pool which are trying to write the data under the data/index folder and that are colliding with each other?
| |
You can also move the comment to in between the xml and configuration node, or anywhere else within the sitecore node, and it should be fine
This is how a lot of the default example Sitecore configuration files have their comments:
<?xml version="1.0"?>
<!--
Purpose: **** Comments here are fine ****
-->
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/">
<sitecore>
<pipelines>
<getContentEditorWarnings>
<!-- **** Comments here are also fine **** -->
<processor type="Sitecore.Commerce.Pipelines.ContentEditorLicenseWarning, Sitecore.Commerce">
<patch:delete />
</processor>
</getContentEditorWarnings>
</pipelines>
</sitecore>
</configuration>
| Error when loading config: Reader in incorrect state
I have an include file to remove the annoying Commerce License Warning on 8.1 update 3. But the patch file fails to load in. The log files show the following error:
"860 10:07:58 ERROR Could not load configuration file: [file location]: System.Exception: Reader is in incorrect state"
This is the patch file:
<?xml version="1.0"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/">
<!--
Fixes: Missing Sitecore.Commerce.Connect licenses message in Content Editor - kb article 852031
Link: https://kb.sitecore.net/articles/852031
If you do not have keys for the Sitecore.Commerce.Connect or Sitecore.Commerce.ConnectPartner modules in your license file, the following message may be displayed above the "Quick info" section when opening the Content Editor:
You require one of the following licenses to use the Sitecore Commerce Connect module.
"Sitecore.Commerce.Connect" or "Sitecore.Commerce.ConnectPartner"
These license keys are not included by default.
-->
<sitecore>
<pipelines>
<getContentEditorWarnings>
<processor type="Sitecore.Commerce.Pipelines.ContentEditorLicenseWarning, Sitecore.Commerce">
<patch:delete />
</processor>
</getContentEditorWarnings>
</pipelines>
</sitecore>
</configuration>
A more annoying aspect is that on my local dev environment this patch files works fine. But when deployed it does not!
| |
You have to tell which areas of your site require the login.
Remove read access for extranet/anonymous user for the item which should be protected with login.
| Sitecore site configuration requireLogin not working
If I wanted to force users to go through a login for the entire site. I would previously add requireLogin and loginPage attributes to my site configuration.
In 8.2 I am unable to do this. However in 8.1 this works. Any ideas how this has changed? Or am I doing something wrong and missing something.
<site name="website">
<patch:attribute name="loginPage">/sitecore modules/shell/login.aspx</patch:attribute>
<patch:attribute name="requireLogin">true</patch:attribute>
</site>
The attributes work for admin site configuration.
Read access for extranet/anonymous was removed for the protected area of the page as well.
Any ideas?
| |
You are correct—the "Ignore Additional Registrations" checkbox will make sure that nothing happens in case an existing outcome is attempted to be registered again.
Here's an excerpt from the decompiled class Sitecore.Analytics.Outcome.OutcomeManager:
public virtual void Save(IOutcome outcome)
{
if (!this.CanSaveOutcome(outcome))
{
return;
}
this.repository.Save(outcome);
}
private bool CanSaveOutcome(IOutcome outcome)
{
IDefinitionManager<IOutcomeDefinition> definitionManager =
DefinitionManagerFactory.Default.GetDefinitionManager<IOutcomeDefinition>(null);
IOutcomeDefinition outcomeDefinition =
definitionManager.Get(outcome.DefinitionId, CultureInfo.InvariantCulture);
return
outcomeDefinition == null
|| !outcomeDefinition.AdditionalRegistrationsAreIgnored
|| !this.HasOutcome(outcome.EntityId, outcome.DefinitionId);
}
As you can see, OutcomeManager.Save() will only register the outcome if the checkbox "Ignore Additional Registrations" is unchecked, or if the outcome has not been registered yet.
As a side note, it's quite interesting that the outcome will be saved successfully even if you specify a non-existing outcome definition ID in outcome.DefinitionId.
| How can I prevent an outcome from being registered multiple times?
What is the accepted method of preventing a contact from registering an outcome multiple times? For example, if they become a "Marketing Lead", how do I prevent that Outcome from firing again for that contact?
Do you need to programmatically check to see if the outcome has already been registered for the contact? Or is there a configuration setting for this?
I see the "Ignore Additional Registrations" checkbox, but I am not sure what it does.
I am using Sitecore 8.1 Update 2 with xDB Cloud.
| |
Probably the most terse:
string itemPath = item.Paths.FullPath;
SiteInfo site = SiteContextFactory.Sites
.Where (s => s.RootPath !="" & itemPath.StartsWith(s.RootPath, StringComparison.OrdinalIgnoreCase))
.OrderByDescending(s => s.RootPath.Length)
.FirstOrDefault();
itemPath is factored out of the LINQ for performance.
| How to get the correct SiteContext for an Item when you only have the Item
You only have an instance of Item.
How do you get it's "official" site, assuming there are multiple Sites defined in configuration?
| |
The correct way to resolve this would be to fix the cause of the issue and reduce the item length to less than 100 on the problematic item.
As you have also found, you can increase the MaxItemNameLength to a higher number to get around the issue.
Be aware though, the Name field in the Items table in the database has a data type of nvarchar(256) so setting this value to more than 256 may cause you issues.
I would also recommend you revert this setting back to 100 (by deleting your patch config) after installing your content package since this directly affects your URLs and your content editors may therefore be able to create very long item names. Again, I highly recommend you identify the problematic item and reduce the item length to not cause issues in the future.
| An item name lenght should be less or equal to 100 while installing a content package
I've got a vanilla instance of Sitecore 8.2 installed on my sandbox and I'm getting this error (taken from the logs):
Exception: Sitecore.Exceptions.InvalidItemNameException Message: An
item name lenght should be less or equal to 100. Source:
Sitecore.Kernel at Sitecore.Data.Items.ItemUtil.AssertItemName(Item
destinationItem, String name) at
Sitecore.Data.Items.Item.set_Name(String value) at
Sitecore.Install.Items.ItemInstaller.VersionInstaller.InstallVersion(Item
version) at
Sitecore.Install.Items.ItemInstaller.VersionInstaller.PasteVersion(XmlNode
versionXml, Item target, VersionInstallMode mode, IProcessingContext
context, Boolean removeOtherVersions) at
Sitecore.Install.Items.ItemInstaller.InstallEntry(PackageEntry entry)
What config setting do I need to change in order to get past this error?
| |
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 find in the tree underneath your template item
ps: field.Value will call this function will all parameters true.
| Field StandardValue vs DefaultValue vs FallbackValue vs InheritValue vs InnerValue
The parameters of the GetValue methods of the Sitecore.Data.Fields.Field class enable developers to restrict the origin of the returned value to the Fields:
StandardValue
DefaultValue
FallbackValue
InheritValue
InnerValue
What are the differences between each of these?
| |
That exception originates from Sitecore.Data.Items.ItemUtil.GetItemNameError(string name) method in Sitecore.Kernel:
if (itemNameValidation.Length > 0 && !Regex.IsMatch(name, itemNameValidation, RegexOptions.ECMAScript))
return string.Format(Translate.Text("An item name must satisfy the pattern: {0} (controlled by the setting ItemNameValidation)"), (object) itemNameValidation);
A quick and dirty test shows that the item name /sitecore/content/Content Source/people/2014/10/22/12/58/lütz-alexandra should pass this validation. The following unit test passes when run:
[Test]
public void TestEuropeanName()
{
string itemName = "/sitecore/content/Content Source/people/2014/10/22/12/58/lütz-alexandra/";
string regex = @"^[\w\*\$][\w\s\-\$]*(\(\d{1,}\)){0,1}$";
Assert.IsTrue(itemName.Length > 0 &&
!Regex.IsMatch(itemName, regex, RegexOptions.ECMAScript), "Item name fails regex test!");
}
However, the item name I used was from your original question, where the actual name being used is the name in the items/master/sitecore/content/Content Source/people/2014/10/22/12/58/lütz-alexandra/{AC7C6913-A1C7-479E-9B61-C9F247026699}/en/1/xml file in your package. Check the name attribute on the item element in that XML file to see what the actual name Sitecore is trying to use.
If all else fails (or if you don't want to bother with the above), you can set the ItemNameValidation field to an empty string, install your package, then restore the ItemNameValidation field's original value.
| An item name must satisfy the pattern: ^[\w\*\$][\w\s\-\$]*(\(\d{1,}\)){0,1}$ (controlled by the setting ItemNameValidation)
While installing a content package from my production environment (Sitecore 8.1) into my development environment (Sitecore 8.2), I'm seeing this error message in my Sitecore log:
ManagedPoolThread #2 11:07:07 ERROR Error installing
items/master/sitecore/content/Content
Source/people/2014/10/22/12/58/lütz-alexandra/{AC7C6913-A1C7-479E-9B61-C9F247026699}/en/1/xml
Exception: Sitecore.Exceptions.InvalidItemNameException Message: An
item name must satisfy the pattern:
^[\w*\$][\w\s-\$]*((\d{1,})){0,1}$ (controlled by the setting
ItemNameValidation) Source: Sitecore.Kernel at
Sitecore.Data.Items.ItemUtil.AssertItemName(Item destinationItem,
String name) at Sitecore.Data.Items.Item.set_Name(String value)
at
Sitecore.Install.Items.ItemInstaller.VersionInstaller.InstallVersion(Item
version) at
Sitecore.Install.Items.ItemInstaller.VersionInstaller.PasteVersion(XmlNode
versionXml, Item target, VersionInstallMode mode, IProcessingContext
context, Boolean removeOtherVersions) at
Sitecore.Install.Items.ItemInstaller.InstallEntry(PackageEntry entry)
I believe that this message is coming from the fact that my item name has a European character in it's item name (ü). I've looked into my sitecore.config file and found this value for the ItemNameValidation setting:
<!-- ITEM NAME VALIDATION
Regular expression for validating item names
-->
<setting name="ItemNameValidation" value="^[\w\*\$][\w\s\-\$]*(\(\d{1,}\)){0,1}$" />
From what I can tell, the \w should be allow that character to be valid, but I have a suspicion that it's not working that way. I'm thinking that I need to include \p{L} embedded into the regex somewhere to support international characters. I can't help thinking that since Sitecore is developed in a European country, that they would support European character sets out of the box. Any ideas on how to correct this error?
| |
Habitat is intended to inspire your solutions; you should never start with the Habitat solution and add to it when creating a new site. Habitat is not an accelerator, it is an example of the Helix principles outlined here: helix.sitecore.net.
When you create a new solution, you may want to refer to the Habitat solution for things like:
Solution structure (e.g., Foundation, Feature, and Project folders)
Project and module structure (e.g., make folders for each module and keep module code and unit tests together)
Build system (e.g., how to deploy code to webroot and stitch web.config transforms together)
Information architecture (e.g., where to put globally-shared content, site-specific content, and page-specific content)
Pick and choose the things you like, let Habitat inspire your solution, but do not build sites on top of it.
| How do you create a site modeled after the Habitat solution when starting from scratch?
I recently discovered Habitat and I really like the modular design and how it provides an end-to-end sort of pattern and process for organizing your Sitecore site, but the Habitat solution includes so many projects that I'm not sure where to start when creating a new site from scratch.
I did find the Sitecore.Demo.Group project which seemed like exactly what I was looking for, but this project seems to plug into an existing Habitat solution. Do people typically start with a complete Habitat solution and just add to it when creating a new site? Are there any examples out there that show how to start with a brand new solution and build up a site modeled after the Habitat solution?
| |
You don't actually need a package - Sitecore gives you this ability out of the box.
What I normally do is; I have a "global" area, and a "page local" area for datasource content.
The way you set it up, is to go to your "Datasource Location" field on your rendering definition, and pipe | the different data sources - one of them bing relative to your context item.
In this example, the content is not a direct child of the content item - but resides in a "Local Data" folder beneath it.
When doing it like this; Sitecore will allow you to switch between different root folders when selecting to "use existing content" or "create new content".
| Item level datasourcing
In several of the accelerators available: Score, SXA, etc... when creating a new item for a rendering datasource, you have a folder available to put the new item right under the current item or in a tenant folder. Is there a package or github repo out there that helps get this set up in a custom solution?
| |
Setting ContentSearch.VerboseLogging to true can help give you diagnostic info on search index activity. Or a set of memory dumps when the thread appears to hang.
You may benefit from using the verbose logging along with this patch to turn up the details . . .
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<events>
<event name="indexing:start">
<patch:attribute name="timingLevel">high</patch:attribute>
</event>
<event name="indexing:start:remote">
<patch:attribute name="timingLevel">high</patch:attribute>
</event>
<event name="indexing:end">
<patch:attribute name="timingLevel">high</patch:attribute>
</event>
<event name="indexing:end:remote">
<patch:attribute name="timingLevel">high</patch:attribute>
</event>
</events>
</sitecore>
</configuration>
| Sitecore index update jobs getting stuck
I'm having trouble configuring a Sitecore 7.2 production environment and noticed some weird things on the CM environment..
After a few updates to the sitecore_master_index the jobs to update the index get stuck in the job queue and never get progressed and subsequently a ton of jobs get queued up (I'm using the Job Viewer to examine the Queue). I can't find anything in the Crawling log and no exceptions in the normal log. When I try to rebuild the index I get a "queued" message.
The slightly unusual thing is (I know it's not recommended practice to expose master content from the cd server unless necessary), that I have syncmaster strategy configured for a separate index rather than just the sitecore_master_index but can't see how this would cause jobs to back up.
I know I haven't provided a huge amount of detail, but does anyone know of any reason of why this would happen or if there is a way to make sure these jobs die after a certain amount of time?
| |
It appears that the pipeline has changed between webforms and MVC. The Success pipeline for MVC is <wffm.success> and can be found in Sitecore.MvcForms.config. Through this you have access to the FormModel
public class SuccessRedirect : FormProcessorBase<IFormModel>
{
public override void Process(FormProcessorArgs<IFormModel> args)
{
Assert.ArgumentNotNull((object)args, "args");
var model = args.Model as FormModel;
if (model == null)
return;
model.SuccessRedirectUrl = model.SuccessRedirectUrl + "?val=" + model.Results[0].Value;
}
}
Check out http://ggullentops.blogspot.com.au/2016/07/sitecore-wffm-act-on-success.html for more information and some options on customising post-success actions.
| Change redirect url after success in WFFM
I have a WFFM form with a hidden field on it. The field contains a value that I would like to know on the success page - in order to use it in custom code in a rendering or even for personalization.
Is there a way to pass data from the form to the success page? Maybe by changing the redirect url and add a querystring...
Using MVC forms in v8.1.
| |
You should look at jQuery.noConflict(). Use this jQuery method in your JS to avoid conflicts with WFFM included jQuery libs
UPDATE:
In response to your updated question: no, there is no way to tell WFFM not to use jQuery, but because jQuery registers itself as an AMD module, you should be able to check to see if jQuery is already on the page before you call jQuery.noConflict(). You can do this using the following code:
if (typeof window.jQuery != 'undefined') {
// now call noConflict and any other logic
}
You will likely want to run that script in a $(window).load(...) handler
| Dealing with jQuery version collisions in WFFM
I've got a v7.2 site which is using Web Forms for Marketers v2.4 rev 151103 (WFFM) for some forms. I am seeing some errors in our javascript that I strongly suspect is related to the fact that WFFM is including an old version of jQuery.
What is the accepted way to handle this? Our code, as an example, trying to use the .on method to adjust an iFrame height, but this wasn't added until jQuery 1.7 (WFFM includes 1.4.2)
$('.modal-body iframe').on('load', function() {
this.style.height = 0;
this.style.height = this.contentWindow.document.body.scrollHeight + 'px';
});
Update
I've tried .noConflict(), but this only solves the issue on pages I have the Form rendering on (and therefore two versions of jQuery). Is there a way to get WFFM 2.4 to no output the reference to jQuery? I know later versions have settings to supress using Bootstrap.
| |
In my opinion, these are the scopes you need to consider:
Global (across multiple sites)
Site (across an entire site)
Pillar/Section (used across an entire subtree of a site)
Page (Used only on this page)
Using only one location does not allow you to scope your security appropriately for your authors. If you have a single global folder, that means giving authors from all sites and pages access to a single repository where they can potentially edit content from other sites. This is a big issue with multi-tenant and multi-site (though in some cases is actually helpful for shared content across sites).
The page-specific content allows your authors to maintain their own little 'bucket' of scope that other users can't select for re-use. Some content governance folks might not like the idea of private content, but I haven't met an author yet who didn't have the "but this is special just for me" need.
Section/pillar scope is useful when working with large sites that tend to divide their IA by department, business, or brand. You will often have different teams managing these sub-trees and often different roles and permissions. Their shared content is not the same as the site-wide header that might be in use across the whole site.
If you can provide those 4 levels of datasource scopes, you should be able to cover most scenarios for content management governance.
| Where should I store data source items?
I've seen two schools of thought on structuring the content tree as it relates to datasource items:
Store datasource items in a folder underneath the context item
Store data source items in a folder outside of the items representing pags ("global" folder, "metadata" folder, etc.)
What are the advantages/disadvantages to these approaches? The Habitat implementation of Helix seems to favor the second.
| |
There are three aspects in choosing a DI approach with Sitecore 8.2:
The decision of which dependency injection container to use.
The way you integrate the container with Sitecore and ASP.NET MVC.
The pattern in which service dependencies and implementations are registered.
Picking a DI container
Sitecore 8.2 uses IServiceProvider / IServiceCollection as its DI container abstraction. Microsoft's implementation of this container, Microsoft.Extensions.DependencyInjection.ServiceProvider, is used by default.
If you want, you can replace the default container completely, or you can override ASP.NET dependency resolvers. Either way, you're not bound to use the DI container Sitecore provides out of the box.
If you chose to use an alternative container, there's plenty to choose from.
The default container doesn't have many advanced features of the leading DI libraries. Just as an example, with Autofac you can mass-register all of your services like this:
builder
.RegisterAssemblyTypes(AppDomain.CurrentDomain.GetAssemblies())
.Where(t =>t.GetInterfaces().Any(i => i.IsAssignableFrom(typeof(IService))))
.AsImplementedInterfaces()
.InstancePerLifetimeScope();
Also, SimpleInjector provides a way to quickly register all MVC Controllers in the container:
container.RegisterMvcControllers(Assembly.GetExecutingAssembly());
In contrast, with the default container you'd have to use quite a bit of custom code to achieve the same result.
As a conclusion, it seems to me that the most "standard" way is to use the default container shipped with Sitecore. It's the most basic way too, though, so you can gain a lot by replacing the container.
Integrating the container with Sitecore
Obviously, if you've chosen to go with the default container, you don't have to do anything.
If you want to use another DI container, you have two options:
Let Sitecore use their container internally and use you container of choice in your application code and in ASP.NET controllers. This is done by overriding ASP.NET dependency resolvers and making sure there's a fallback to Sitecore's resolvers. This was the commonly accepted approach before Sitecore 8.2, and it still works well today.
Replace the container completely. You do that by creating your own service provider builder and patching the <serviceProviderBuilder> node in Sitecore.config. The benefit of this approach is that your custom services, along with Sitecore's internal services, are now easily accessible, replaceable and injectable through your DI container of choice. There is only one DI container in the system, which makes things simpler and more convenient.
I don't think either of these approaches is standard. My personal preference is to completely replace the default container, as it requires less code, less configuration, and it doesn't leave two containers existing in parallel, thus avoiding confusion and errors.
Registering services in the container
This is the least opinionated part. In simple applications that don't have many modules, registering all services in the composition root is perfectly acceptable.
If you have many fine-grained components (which you'll definitely have if you use Helix), then it makes a lot of sense to separate service registrations from the composition root and delegate this task to each component.
As far as I'm aware, there are three main approaches here. To register component-specific services in your container, you can:
Create a separate configuration file (e.g. use <service> registrations with the default container) for every component.
Or use a separate configurator class per component (every modern DI library has these).
Or use a custom pipeline—this way, every container that needs to register its services will create its own processor included as a step in the pipeline. Here's another article that mentions the same approach.
I don't believe there's a clear winner here. You'll have to decide what fits best with your architecture and the structure of your solution.
| Best approach for Dependency Injection in Sitecore 8.2
I see a fair few approaches in blog posts for using DI with 8.2, particularly around the registration. Is there an approach which would be recommended - particularly with a Helix compatible architecture?
http://kamsar.net/index.php/2016/08/Dependency-Injection-in-Sitecore-8-2/
https://ctor.io/one-way-to-implement-dependency-injection-for-sitecore-habitat/
http://www.sitecorenutsbolts.net/2016/09/17/Habitat-Dependency-Injection-with-Sitecore-8-2/
| |
You may have a look at the module LUCENE SPATIAL SEARCH SUPPORT on the Sitecore Marketplace. There is a link to the github repo which should give you an example of how that was done for Sitecore 7; hopefully not much has changed.
The creator built a library referencing these Lucene libraries:
Lucene.Net.Contrib.Spatial.dll
Lucene.Net.dll
Spatial4n.Core.dll
Then built an API on top with the appropriate ContentSearch configuration files. Perhaps not too straight forward but can be done.
As an aside, the Sitecore Experience Accelerator (SXA) comes with this feature built in for Lucene using a similar approach.
| Lucene spatial search with sitecore 8.2
I have a template with latitude and longitude field. I want to able to use lucene to search for records within given radius. I haven't found any code sample that works with sitecore 8.2. I've been told to use solr which is more feature rich but solr seems to complex for my needs as I'm not dealing with huge records.
Can someone guide me on how I can go about creating my own custom contentsearch library?
Thanks.
| |
Right click on your Solution tab and check the Project Dependencies. Ensure that the Build Order reflects the proper dependency order:
Foundation
Feature
Project
... and that in general, templates are pushed before their content. If need be, use the Dependencies tab to adjust project dependencies to adjust the build order.
Then, and only then, try a Build > Deploy. This will push all your TDS content, according to the Build Order, without having to manually sync each project.
| Habitat TDS Version - Sync Items to Sitecore
Keep in mind I'm a relative newbie to TDS, but looking through some of the documentation, I'm not sure I have found an answer that solidifies I'm doing something wrong.
I've got TDS installed and pulled down the TDS version of Habitat from GitHub, restored NuGet packages fine and published to target. As the last step to get set up, I was unsure, if there was a certain order to Sync the items with Sitecore or if it could be done all at once. Going to the solution node in VS and choosing Sync all TDS Projects using History didn't seem to do it, so then I started going project by project and choosing Sync with Sitecore
This is where I'm having difficulty because TDS throws errors. Most errors I'm seeing are
> TDS not being able to update Standard Values due to the parent
> template missing the fields such as '__Masters' and '__Created':
So, I'm wondering is there a particular order to sync, is there a more efficient option, or am I just completely going about this in the wrong way? Thanks in advance!
| |
This is a question with really a mryaid of possibilities for an answer.
It boils down to client requirements.
As a Best Practice, I advocate working with the business owner to iron out what the real requirements for workflow, security, and guard rails, are and then based on that information, create stories for tailoring Sitecore to your desire.
Sitecore makes it very easy to build in the guard rails you need in order to limit breaking links from deletions.
Options include:
Event Handlers for delete, rename, and move
Custom Button overrides to toggle enablement of delete button.
And if you're feeling creative, create your own custom pipeline to validate whether an item can be deleted that makes it extendable as use cases grow.
| Prevent author from accidently breaking lots of links
Looking for best practices to prevent accidently removing lots of links.
I think there has been improvements in this area.
Scenario delete home node (accidently), popup launches for option for break links dialog.
Select remove broken links, thinking deleting another node.
Break links takes a while.
Cancel delete operation.
Job to remove broken links continues in back ground.
Later realise lots of links have been removed, and roll back database.
At time was a bug, when deleting a proxy configuration item that didn't refresh UI.
And so if went to delete item again, as item already deleted would default to the hone node and delete that instead. (fixed since)
Also seen case where content author deleted a large section, and chose remove broken links.
One is education, saying in dialog what actions will be performed, how many items deleting, how many links about to break etc.
Defaulting option to not break links.
Other is extending pipeline to prevent mass deletion of items.
Recall adding pipeline before to say are you sure you want to delete 100 items etc, and preventing deleting 1000 items in one go.
Other is auditing/alerting that a bulk delete/remive links operation has been requested.
Do doesn't go days before realising all links broken in master.
Wondering what best practices are, how others have protected from these scenarios
| |
As the product owner, let me confirm.
In version 1.x --> 3.2 the Email reporting stack was built on a foundation that was inconsistent, inaccurate and not able to scale with the future of Sitecore. The reporting UI was poor and did not meet the expectations of nearly any of our customers.
This means we had to take huge steps to make our customers happy in the long term.
It was not a case of putting a new UI on the old data foundation, because 70% of the data points our customers told us they needed, did not exist, we needed to capture them and store them in a scalable way.
There was no consistent or reliable way for us to extract the old email data and "convert" it into the new data. you would have ended up with your old campaigns showing half complete reports, with most likely different results to what the marketer saw before. Sad, I know, but a consequence of bad decisions (years ago) and a changing world.
So, when you upgrade from 3.2 --> 3.3+, the data for opens and clicks, will be in the rDB, (and you still have all your old sent messages, templates, list associations etc.) however you will have no way to view that data in the new reporting UI. You are welcome to either build something yourself or extract it for sentimental purposes. Your web analytics are also not affected (i.e showing channel attribution for clicks and value).
The new reporting foundation now captures all of the data you are likely to need, in a reliable and accurate way. It leverages the xDB correctly and then aggregates them into the existing Sitecore Analytics stack so that we were able to show them in plenty of pretty charts, in many different ways.
The benefits of the new approach:
Pretty charts, in HTML5 (not Silverlight)
Highly accurate, scalable data
Integrates seamlessly with the Experience Profile
Reduces load on analytics platform
Standardizes data framework for channels (web/email)
Allows Contact level lists & charts in version 3.4
Huge savings in development and testing overheads over time
Hopefully that summarizes the decisions made and makes you feel more comfortable, if you need to discuss it directly with a customer and need support, please reach out to your local regional contact and they can schedule a time with me.
I trust you see the value in the new approach and that it was a difficult decision to make.
Kind Regards
Anthony
| Can ECM 2.2 be upgraded with analytics data to EXM 3.3 at all?
After reading this written by Sitecorehacker on the Sitecore Slack channel I fell off my seat:
"The "upgrade" from 3.2 to 3.3.. goes silent and walks away
I kid, but not really. The upgrade form 3.2 to 3.3 includes a breaking change that resets and disregards all previous analytical email data.
More of an issue for people with established ECM installs that have upgrade to EXM"
Check it out here
That means it's a breaking issue for a current upgrade project. Does anyone know if it is even possible to go from ECM 2.2 to EXM 3.3 while somehow keeping your email analytics data?
| |
Trigger Auto-Archiving
You could write a publish:end:remote event that kicks off some logic to find all item versions "eligible for archiving," based on your criteria. You can then archive those versions that are n versions behind the latest.
Archiving
Now that your auto-archiving logic is created, you need to actually perform the archiving. How you do this is really up to you, as there are many was to create an archive. My preference is to create a folder item as a sibling of the home item and use permissions to ensure that only authenticated users with a particular role can view it. In your code, you would use a SecurityDisabler when moving the item, so access rights shouldn't be an issue for the "archiver" logic.
Preserving References
As mentioned in the OP, references on the item being archived to other times will be preseved, and it looks like this is desired. However, it looks like you also want to be able to preserve references to the item being archived for later viewing. You could use the links database to GetReferrers, and then record the resulting list as a list of item IDs.
I have to ask why you would want to do this. If those items are deleted then this list is meaningless. The same goes for recording the referrers as item paths, only now you have to worry about an item-rename making the whole or part of the list meaningless. Bottom-line: unless you plan to make an entire historical record of every item that you've ever had in the system (and this would be a LOT of work if you want to make it meaningful) then I wouldn't advise doing this.
Breaking References
It was implied by the OP - though not explicitly stated - that you will need to break links to the items that you are archiving. I haven't done this myself, but you should be able to replicate the logic for breaking links that is fired when deleting an item. Don't forget to do this, or else you will have items that are not archived referencing items that are archived.
| Limiting version numbers/copying old versions to archive for easy access
Sitecore recommends limiting number of items to up to 10 versions per item.
The version manager module can be used to limit the number of item versions.
This can either be run periodically, or when the number of item versions goes above a set number. When run, the module deletes old versions of the item.
I recall that this module used to require the user running the operation to have permission to delete in order for the old version to be removed.
Rather than delete old versions after a certain limit, we want it to only delete versions which aren't either currently on live, or queued up to go live via publishing restrictions / lifetime. This way, the module doesn't end up "unpublishing" items, regardless of age or version count. Additionally, rather than delete the version, we would like to copy the version being removed to an archive. Copying to the archive will preserve references to any datasources, but we would also like to see if there is a way to take a snapshot of any dependencies on the item being archived.
I would be interested to see how others have dealt with ensuring version numbers are kept low, while continuing to support the stacking of future items, and keeping an archive, in order to be able to view past versions.
| |
As Rodrigo Peplau suggests, sitecore/admin/showconfig.aspx is good for viewing the entire merged Sitecore configuration. So you could use that as the basis for your comparison between the environments.
The error message indicates that you have a problem with handling the packageinstall:items:ended event.
The event is configured in Sitecore.config
The stack trace points specifically to it originating from the OnPackageInstallItemsEndHandler method in Sitecore.ContentSearch.Events.PackagingEventHandler
The handler is configured in Sitecore.ContentSearch.config
The exception occurs when Sitecore checks if the item being crawled is excluded from a given index. So You could also check the config files for each of the indexes that cover the master DB.
Alternatively the 'object reference' exception might mean that Sitecore is trying to index an item that doesn't exist. So I would check to see if item {993E4B00-B5A0-46FC-8135-2545A9472B22} ever actually got installed on the target DB.
| Installing package acting different between 2 environments
I've got 2 developer sandbox instances of Sitecore 8.2, and in one instance the package works fine. However, in the other one, I'm getting this error while trying to install a package:
> ManagedPoolThread #17 16:20:58 INFO Installing item:
> items/master/sitecore/media
> library/Images/articles/youre-driving-me-crazy/{993E4B00-B5A0-46FC-8135-2545A9472B22}/en/1/xml
> ManagedPoolThread #17 16:20:58 ERROR One or more exceptions occurred
> while processing the subscribers to the 'packageinstall:items:ended'
> event. Exception[1]: System.NullReferenceException Message[1]: Object
> reference not set to an instance of an object. Source[1]:
> Sitecore.ContentSearch at
> Sitecore.ContentSearch.SitecoreItemCrawler.IsExcludedFromIndex(SitecoreIndexableItem
> indexable, Boolean checkLocation) at
> Sitecore.ContentSearch.Pipelines.GetContextIndex.FetchIndex.c__DisplayClassb.b__3(f__AnonymousType2`2
> h__TransparentIdentifier0) at
> System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext() at
> System.Linq.Enumerable.d__63`1.MoveNext() at
> System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext() at
> System.Linq.Buffer`1..ctor(IEnumerable`1 source) at
> System.Linq.OrderedEnumerable`1.d__1.MoveNext() at
> System.Linq.Buffer`1..ctor(IEnumerable`1 source) at
> System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source) at
> Sitecore.ContentSearch.Pipelines.GetContextIndex.FetchIndex.GetContextIndex(IIndexable
> indexable, GetContextIndexArgs args) at
> Sitecore.ContentSearch.Pipelines.GetContextIndex.FetchIndex.Process(GetContextIndexArgs
> args) at (Object , Object[] ) at
> Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) at
> Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName,
> PipelineArgs args, String pipelineDomain) at
> Sitecore.Abstractions.CorePipelineWrapper.Run(String pipelineName,
> PipelineArgs args) at
> Sitecore.ContentSearch.Pipelines.GetContextIndex.GetContextIndexPipeline.Run(ICorePipeline
> pipeline, GetContextIndexArgs args) at
> System.Linq.Lookup`2.Create[TSource](IEnumerable`1 source, Func`2
> keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
> at System.Linq.GroupedEnumerable`3.GetEnumerator() at
> Sitecore.ContentSearch.Events.PackagingEventHandler.OnPackageInstallItemsEndHandler(Object
> sender, EventArgs e) at
> Sitecore.Events.Event.EventSubscribers.RaiseEvent(String eventName,
> Object[] parameters, EventResult result)
I've checked the configs between the 2 environments and they seem to be the same. What specific configs should I be looking for, and what other settings should I look at to figure out what the problem is with this 2nd instance?
| |
There's a web.config that has Sitecore references that should exist in the /Views that is probably not right.
This can be a common occurrence if using a new .NET MVC Project in Visual Studio and it accidently overwrites the Sitecore version.
You can grab the web.config from the Sitecore Vanilla Zip file to compare.
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
<add namespace="Sitecore.Mvc" />
<add namespace="Sitecore.Mvc.Presentation" />
<add namespace="System.Web.Optimization" />
</namespaces>
</pages>
</system.web.webPages.razor>
| C# MVC razor view - HtmlHelper does not contain a definition for 'Sitecore'
Has anyone experienced an error described in the image below where the HtmlHelper in razor view is not recognizing Sitecore when I try to specify a placeholder?
Thanks for your help!
| |
There are actually a few options here:
Command Templates
Event handlers (item:added)
Pipeline processors (uiAddFromTemplate, addFromTemplate)
Command Templates
This is by far the simplest solution, requiring the least implementation effort but is also the least extensible and flexible.
What you would do is create a command template item under the branch template that you would would like to run the logic from. You would then reference your code from the command template or you could add a script directly to the command template, though I advise against this. To add a little extensibility, you could make a branch template specifically for the command template and add an instance of that branch template to whichever branch template(s) you would like the logic to be run for.
Event Handler
I should start by noting that the item:added event has been deprecated (not sure which version), and unfortunately the branch template cannot be retrieved from the args of the item:created event. However, if you are using an older version of Sitecore then this is still an (albeit unrecommended) option.
What you would do is create your item:added handler and trigger your custom logic, rules, etc. from there.
Pipeline Processors
This is my recommended approach, and the most extensible, flexible and currently supported solution.
There are two pipeline processors that you could use for this: the uiAddFromTemplate pipeline and the new AddFromTemplate (item provider) pipeline.
The uiAddFromTemplate pipeline runs whenever someone right-clicks an item and adds an item via the "Add From Template" flyout context menu. There is some good documentation out there on this pipeline, between Sitecore docs and blog posts, but there is a major problem with it: the item has to be added from the UI (using the method described above), i.e. adding an item from code or any other method will not trigger the pipeline.
The other option is to use the AddFromTemplate pipline, which is one of the new item provider pipelines. The AddFromTemplate pipeline succeeds where the uiAddFromTemplate pipeline fails, in that it is run whenever an item is added, regardless of whether the ite was added from the UI or from code. Note that the pipeline will run once per transaction, i.e. if you are adding a single item it will run once, and if you are adding a branch template it will run once for the entire subtree being added. In contrast to the uiAddFromTemplate pipeline, there is pretty much no documentation and I have seen very little in the way of blog posts about the AddFromTemplate pipeline. This is likely because of how new the item provider pipelines are and is likely to change in the future.
For now, I'm just going to leave this right here:
public override void Process([NotNull] AddFromTemplateArgs args)
{
// this is managed in configuration (runIfAborted=true would have to be set to override the value)
if (args.Aborted)
{
return;
}
Assert.IsNotNull(args.FallbackProvider, "FallbackProvider is null");
try
{
var item = args.FallbackProvider.AddFromTemplate(args.ItemName, args.TemplateId, args.Destination, args.NewId);
if (item == null)
{
return;
}
args.ProcessorItem = args.Result = item;
}
catch (Exception ex)
{
Log.Error("PROCESSOR NAME for Pipeline AddFromTemplate failed. Removing partially created item if it exists.", ex, this);
var item = args.Destination.Database.GetItem(args.NewId);
item?.Delete();
throw;
}
// your logic here
}
| Execute custom logic whenever an item is added from a particular branch template
I am looking to run some custom logic (likely some rules) whenever an item is added from a particular branch template. How can I trigger this logic to run, in Sitecore.
| |
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 abstract class to serve as a base for disablers that you may find useful:
public abstract class Disabler<TSwitchType> : Switcher<DisablerState, TSwitchType>
{
public Disabler() : base(DisablerState.Enabled)
{
}
public static bool IsActive => CurrentValue == DisablerState.Enabled;
}
public enum DisablerState
{
Disabled,
Enabled
}
Note that the Switcher class is used for more than just Sitecore's disablers. It is also used for Sitecore's various ____Switcher classes, like the SiteContextSwitcher, the LanguageSwitcher, and more. The class works by reading from and moving objects in the stack, and arguably one of the most under-utilized features of the Sitecore API.
Example 1: Pipeline Processor Disabler
I first created the following disabler:
public sealed class SaveItemLogicDisabler : Disabler<SaveItemLogicDisabler>
{
}
I then created my <saveItem> pipeline processor and added a check to see if the disabler was active. If so, I skipped executing that processor. Note that I made the intentional implementation decision to not abort the pipeline, here, as there are other processors that I may still want to run.
public override void Process([NotNull] SaveItemArgs args)
{
// this is managed in configuration (runIfAborted=true would have to be set to override the value)
if (args.Aborted)
{
return;
}
Assert.IsNotNull(args.Item, "Item is null");
Assert.IsNotNull(args.FallbackProvider, "FallbackProvider is null");
args.ProcessorItem = args.Item;
args.Result = args.FallbackProvider.SaveItem(args.Item);
// check disabler and decide whether or not to continue execution
if (SaveItemLogicDisabler.IsActive)
{
return;
}
// additional processor logic here...
}
Example 2: Event Handler Disabler
Let's say that I want to use the same disabler for my item:saved events.
I can actually do the exact same check inside of my event handler:
private void OnItemSaved([NotNull] object sender, [NotNull] EventArgs args)
{
Assert.ArgumentNotNull(sender, nameof(sender));
Assert.ArgumentNotNull(args, nameof(args));
if (string.IsNullOrWhiteSpace(this.RuleFolderId))
{
return;
}
// check disabler and decide whether or not to continue execution
if (SaveItemLogicDisabler.IsActive)
{
return;
}
// additional handler logic here...
}
| How can I write my own custom disabler?
Sitecore ships with a bunch of disablers, like the SecurityDisabler and the EventsDisabler, but what if I want to write my own?
I have a bunch of item:saved event handlers that run but when I add a new item from a particular snippet of code I want to disable one of my item:saved event handlers' logic. If possible, I would like to have a solution that I could use for the same purpose in a custom pipeline processor too. How would I go about this?
| |
You have a few good options.
Module:
You were probably looking for this.
https://marketplace.sitecore.net/en/Modules/Media_Conversion_Tool.aspx
Custom Code
I would convert the code in this article to a script in Sitecore PowerShell Extensions since you can both run the existing report for finding them plus run the conversion. Actually sounds like a nice addition to the Media Library Maintenance module bundled with SPE.
https://adesev.wordpress.com/2014/08/06/convert-file-based-media-to-database-storage/
Update
Couldn't help myself so I decided to try this myself.
I first ran the SPE report to confirm that there were items that were file based.
There is currently one on my system.
Little rough and needs some testing but this should do it for you in SPE.
function Get-MediaItemFileBased {
Get-ChildItem -Path "master:\sitecore\media library" -Recurse |
Where-Object { $_.TemplateID -ne [Sitecore.TemplateIDs]::MediaFolder } |
ForEach-Object {
$mediaItem = New-Object Sitecore.Data.Items.MediaItem $PSItem
if($mediaItem.FileBased) {
$mediaItem
}
}
}
function ConvertTo-MediaItemDatabaseBased {
[CmdletBinding()]
param(
[Parameter(Mandatory=$true, ValueFromPipeline=$true)]
[ValidateNotNullOrEmpty()]
[Sitecore.Data.Items.MediaItem]$MediaItem
)
if($MediaItem -eq $null) { continue }
$filePath = [Sitecore.IO.FileUtil]::MapPath($MediaItem.FilePath)
$fileInfo = Get-Item -Path $filePath
if($fileInfo.Exists) {
$mediaCreator = New-Object Sitecore.Resources.Media.MediaCreator
$mediaItemFullPath = $MediaItem.InnerItem.Paths.Path
$mediaCreatorOptions = New-Object Sitecore.Resources.Media.MediaCreatorOptions
$mediaCreatorOptions.FileBased = $false
$mediaCreatorOptions.Destination = $mediaItemFullPath
$mediaCreatorOptions.KeepExisting = $false
$filename = $mediaItem.Name + "." + $mediaItem.Extension
$mediaCreator.AttachStreamToMediaItem($fileInfo.Open([System.IO.FileMode]::Open), $mediaItemFullPath, $filename, $mediaCreatorOptions)
}
}
Get-MediaItemFileBased | ConvertTo-MediaItemDatabaseBased
| Convert disk based media to database
What's the best approach to migrate disk-based media into the database? We inherited a large enterprise site that's getting forklifted to Sitecore 8.2, and it currently uses file-based media. We want to move these into the database, as that's our standard, and makes the solution more scalable.
I found a reference somewhere to a shared source component, but the link is dead: http://trac.sitecore.net/MediaConversionTool/ (DEAD LINK)
Is there anything particular for Sitecore 8.x that others are using?
| |
In my investigation and research into this issue I spoke with Andy Cohen the contributor for this module and he let me know that here is the proper format for Simple Redirect paths:
http://xyzcompany.com/about would just be about in the Path field just the name of the page.
However, if you have a page that is multiple pages deep you separate the folders with a pair of arms (regex stuff). It will look something like this:
http://xyzcompany.com/about/tom/dick/harry would be: about\/tom\/dick\/harry in the Path field.
I verified this works and my redirects are working. Hope this helps someone else. Happy coding!
| URL Rewrite Module Format for Simple Redirects
I just installed the URL Rewrite Module for Sitecore 8.1. However, I do not believe the simple redirects are working correctly. I get my page not found page versus getting the page I want redirected to. The documentation is not very clear either. I need to know what is the proper format for the Path field in the in Simple Redirect template. For example, do I put in http://www.xyzcompany.com/about/test/testpage or /about/test/testpage or what exactly is the proper format here? I just want an incoming old URL to go to the new URL, plain and simple. If someone has a working instance of URL Rewrite Module with Sitecore 8.1 that can help to make my simple redirects work I would greatly appreciate any insight. Thanks in advance!
| |
We have used a powershell script that does everything:
install SQL databases
install solr and configure
configure IIS
install Sitecore
build base VS projects
I would suggest investigating powershell. It will give you a lot of flexibility, for example different steps for different teams.
| Sitecore Instance Manager developer environment setup
I am looking for a way to keep all IIS settings, modules and Sitecore versions in sync across multiple developer environments in a team setting. Is there a way to use Sitecore Instance Manager (SIM), or other tools, to automate a development environment setup?
| |
You might want to consider psake. It is a task based build system written in Powershell.
A good starting point would be this piece of code:
# Let's define layers here
$layers = @( "Foundation", "Feature", "Project" )
# These folders we want to copy to our target
$foldersToCopy = @( "Views", "bin", "App_Config" )
# This is the default task which will run if no tasks are specified
task default -depends CreateReleasePackage
# This is the main task of the scrip - it creates release package
# It relies on Clear to make sure all the garbage from previous run is out
task CreateReleasePackage -Depends Clear,Prepare,BuildSolution {
$layers |% {
Process-Layer $_
}
}
# Cleanup task to remove output of the previous run
task Clear {
if (Test-Path "../target") {
Remove-Item "../target" -recurse
}
}
# Prepare the folders to simplify copying code
task Prepare {
New-Item -type Directory "../target"
$foldersToCopy |% {
New-Item -type Directory "../target/$_"
}
}
# If the solution is not built there is a lot of stuff missing
task BuildSolution {
Exec { msbuild "../Habitat.sln" }
}
# Function to process Layer, ie. iterate over it's directories
function Process-Layer {
param( [string]$layer )
Write-Host "Creating release package for layer: $layer"
Get-ChildItem ../src/$layer |% {
Process-Module $layer $_.Name
}
}
# This function does all the job - it collects the interesting data from the project and copy it to common folder
function Process-Module {
param( [string]$layer, [string]$moduleName )
$foldersToCopy |% {
$folderName = $_
$folder = "../src/$layer/$moduleName/code/$folderName"
# Better check if the folder exists, some modules might not have views or configs
if (Test-Path $folder) {
Write-Host "Copying $folder to ../target/$folderName"
copy-item "$folder/*" "../target/$folderName" -force -recurse -Exclude "Debug"
}
}
}
Now all you have to do is to call a following script from a folder where you have your psake directory:
Import-Module ./psake/psake.psm1
Invoke-Psake ./build.ps1
Note that this is build agains Habitat project and it might be slightly different depending on how your solution is organized
And since you already mentioned powershell it is worth mentioning, that using Sitecore Powershell Extensions you can also automate creation of a Sitecore packages.
You can do this using create-package cmdlet
# Create package
$package = new-package "Sitecore PowerShell Extensions";
# Set package metadata
$package.Sources.Clear();
$package.Metadata.Author = "John Doe";
$package.Metadata.Publisher = "ACME Ltd";
$package.Metadata.Version = "1.0";
$package.Metadata.Readme = 'Information about your package'
# Add contnet/home to the package
$source = Get-Item 'master:\content\home' | New-ItemSource -Name 'Home Page' -InstallMode Overwrite
$package.Sources.Add($source);
# Save package
Export-Package -Project $package -Path "$($package.Name)-$($package.Metadata.Version).zip" -Zip
# Offer the user to download the package
Download-File "$SitecorePackageFolder\$($package.Name)-$($package.Metadata.Version).zip"
| How to package a Helix solution using powershell
Following the Helix modular architecture, my solution is divided into a large amount of separate projects. To deploy the solution as a single package, we need to package all assets, configuration files, views aso. from all the projects into a single deployment package.
Habitat is using gulp for this purpose, however I prefer limiting the amount of dependent tools to a minimum. We are already using Powershell as a tool in our deployment setup, thus this would be the preferred tool for this task also.
Is there any Powershell port of the Habitat gulp tools available? Does any of you have experience with another approach for deploying solutions based on Helix?
| |
I believe the primary reason is each event has an associated target database.
Found a brief explanation here by Kiran Patils on how the event queuing works:
The CM instance triggers an event such as "publish:end:remote".
The triggered event is added to the EventQueue table in the database that is targeted by the event. For example, the publish:end:remote event will be queued up in the publishing target database, typically the web database (unless you’ve specified custom publishing targets/databases).
Every 2 seconds, your CD instances poll the EventQueue table in the database from which they are retrieving content.
If they find an event queued up in the EventQueue table, they attempt to handle the event according to the handlers defined in the /sitecore/events section in their respective web.config files. For instance, by default the publish:end:remote event is configured to execute the HtmlCacheClearer handler for the website site. Handlers can be added or removed as needed.
Note: the interval at which your CD instances poll the EventQueue table is configurable in the web.config file under the /sitecore/eventQueue/processingInterval node.
| Why is event data stored in every Sitecore database?
A table named EventQueue is present in every Sitecore database. It seems to contain local and remote events of Sitecore instances.
Why are some of these events stored in the Core, some in the Master, and some in the Web database? What is the reason behind this separation?
| |
Yes many types of events can be handled locally, not required to be shared to other servers.
See solution #2 at https://kb.sitecore.net/articles/930920 -- using the FileBasedPropertyStore has reduced volume of the EventQueue by 60% or more for some of the large implementations I've worked with. It shifts the specific events to the file system of IIS instead of SQL Server.
| What is the purpose of storing local events in the `EventQueue`?
In Sitecore databases, the EventQueue table contains both local and remote events of Sitecore instances.
Why is there a need to track local events? Can't they just be handled internally in the instance that fired them?
| |
After having processed an event from the queue each instance updates the associated last processing timestamp (LPT) which is stored in the Properties table and has the key in the following format 'EQStamp_{Sitecore-Instance-Name}'
Therefore, you can use the LPT to filter out events which have already been processed by a given instance - literally just the opposite to what the method
GetQueuedEvents(string targetInstanceName) of Sitecore.Eventing.EventQueue does.
There is a Stamp column associated with each event entry in the EventQueue table. The value in Stampis generated automatically by SQL Server (see http://msdn.microsoft.com/en-us/library/ms182776.aspx) when the event is added to the table. The Stamp value of a particular event eventually gets saved as the last processing timestamp for the instance once it's been processed. So if EQStamp_{Sitecore-Instance-Name} equals to 1666508, you can use the following SQL query to retrieve events which have already been processed:
SELECT * FROM EventQueue WHERE Stamp < 1666508
| When is it safe to remove an `EventQueue` record?
Sitecore stores its events in a database table called EventQueue. It is used for centralized event-based communication between Sitecore instances.
Sometimes this table grows quite large and it needs to be cleared of old events. Of course, there's a CleanupEventQueue task in Sitecore that you can schedule to run periodically. But sometimes one may need to clean that table manually.
My question is, when is it safe to remove an EventQueue record from the table? Or in other words, how can I know that a remote event has been fully processed by all instances?
| |
Issue was caused by an replacer being mode="on"
<replacer mode="on" id="publish" type="Sitecore.Text.Replacer, Sitecore.Kernel" singleInstance="true">
changing this setting to mode="off" fixes the issue:
<replacer mode="off" id="publish" type="Sitecore.Text.Replacer, Sitecore.Kernel" singleInstance="true">
| after upgrade from 6.5 to 7.2 Item.Editing.EndEdit() no longer fires event
We have a solution that was upgraded from 6.5 to 7.2. After this upgrade we are having issues where Item.Editing.EndEdit() no longer triggers item:saving/item:saved events. Therefore changes made to the item prior to the EndEdit() are not saved.
EventDisabler.IsActive is false and EndEdit() doesn't throw any exception. Anyone have any idea to what can be happening?
public void SetFieldValue(string itemId, string fieldName, string value)
{
Database masterDB = Sitecore.Configuration.Factory.GetDatabase("master");
var item = masterDB.GetItem(new ID(itemId));
var valuefield = item.Fields[fieldName].Value;
using (new Sitecore.SecurityModel.SecurityDisabler())
{
item.Editing.BeginEdit();
item.Fields[fieldName].Value = valuefield + value;
item.Editing.EndEdit();
}
}
| |
You can configure the LinkManager to use Display Name instead of item title when generating URLs.
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<linkManager>
<providers>
<add name="sitecore">
<patch:attribute name="useDisplayName">true</patch:attribute>
</add>
</providers>
</linkManager>
</sitecore>
</configuration>
The items will still resolve using the title though, so you would probably want to implement redirects to the localized url or use canonical URLs.
| How to manage same item with different URL per language version?
In Sitecore 7.5, it keeps the Item name same across all the language versions
So it is like
For the English language: http://example.com/products/accessories
For German language: http://example.com/de-de/products/accessories
Is possible out-of-the-box or by some customization in Sitecore to be able to create different URL per language for the same item as below?
Required for German language: http://example.com/de-de/produkte/zubehoer
The site is sharing the same content tree across all languages, so having different content tree per language is not a good option here for me. Also, don't want to use Sitecore Alias due to large number of pages we have in the site.
| |
This is a "bug" in the WFFM module, the Sheer UI form does not set a different text for those headings. In a previous version of WFFM which did not include the "Select Existing Form" option I had added this option back in myself so it is possible to override the behaviour and set the "correct" headings.
Make a copy of /sitecore/shell/Applications/Modules/Web Forms for Marketers/InsertFormWizard.xml and place it in /sitecore/shell/Override folder
Update the CodeBeside attribute of the WizardForm element to your custom class
Create a new class as below to override the labels and screen text
using System.Text;
using Sitecore.Data.Items;
using Sitecore.Globalization;
namespace MySite.CMS.Custom
{
public class InsertFormWizard : Sitecore.Forms.Shell.UI.InsertFormWizard
{
protected override void Localize()
{
base.Localize();
// This sets the header and sub-text for the Insert Existing Form screen
this.SelectForm["Header"] = Translate.Text("Select Existing Form");
this.SelectForm["Text"] = Translate.Text("Select an existing form to insert");
}
protected override bool ActivePageChanging(string page, ref string newpage)
{
bool flag = base.ActivePageChanging(page, ref newpage);
if (newpage == "ConfirmationPage" && this.InsertForm.Checked)
{
// This prepends details about the existing form you are selecting
this.ChoicesLiteral.Text = RenderFormSelection() + this.ChoicesLiteral.Text;
}
return flag;
}
private string RenderFormSelection()
{
Item source = ExistingFormSelection();
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.Append(this.RenderBeginSection("FORM"));
stringBuilder.Append($"<p>{Translate.Text("Using existing form")}: {source.Paths.FullPath}</p>");
stringBuilder.Append(this.RenderEndSection());
return stringBuilder.ToString();
}
private Item ExistingFormSelection()
{
string queryString = Sitecore.Web.WebUtil.GetQueryString("la");
Language result = Sitecore.Context.ContentLanguage;
if (!string.IsNullOrEmpty(queryString))
Language.TryParse(Sitecore.Web.WebUtil.GetQueryString("la"), out result);
Item source = this.FormsRoot.Database.GetItem(this.multiTree.Selected, result);
return source;
}
}
}
The header of the final translation screen is shared between all of the selection types so it is not possible to change it on a case by case basis. You could change it by adding a Dictionary entry for it though.
Using the above the screen now look like this:
It is also possible to translate all/most of the labels in the labels displayed. As @aseabridge points out, the default text is indeed embedded in a resource file within the Sitecore.WFFM DLL but labels are retrieved via a call to Sitecore.Globalization.Translate.Text(), which you will see if you follow the calls through DependenciesManager.ResourceManager.Localize(). The text is retrieved from the resource file and then it tries to locate a translation in the Domain Dictionaries (which uses dictionary fallback) otherwise it returns the default text from the resource file. The Key of the dictionary item needs to match exactly as it is in the resource file. If the dictionary items do not exist then you can create them yourself and provide the dictionary (in either domain, master or core dictionary since fallback applies), so this makes it possible to translate the labels to a different language if you wish.
| Fixing wrong wizard titles
I use the WFFM module for a client. The problem is just that there are wrong texts in the wizard for inserting a form:
Select Insert an existing form, press next.
The subtitle under Select a Form is now Copy an _existing_ form. This is misleading as the user expects to insert a form, without duplicating it.
The last step in the wizard states Confirm the configuration of the _new form_. which is equally misleading.
Is there any way I can correct this?
Additions:
Sitecore.NET 8.1 (rev. 160519)
Web Forms for Marketers 8.1.rev. 160523
| |
One approach that we have used is to index the content of all data sources in a single computed field. You can search that field when searching the index. This can probably be improved, but it's a start.
I believe this is also the approach the are using in the Habitat project.
Copied/inspired from: http://kamsar.net/index.php/2014/05/indexing-subcontent/
public class DataSourceContentField : IComputedIndexField
{
public virtual string FieldName { get; set; }
public virtual string ReturnType { get; set; }
// TODO: Change to dictionary with supported template fields as the value
internal static HashSet<ID> SupportedTemplates { get; set; } = new HashSet<ID>();
public object ComputeFieldValue(IIndexable indexable)
{
var sitecoreIndexable = indexable as SitecoreIndexableItem;
if (sitecoreIndexable == null) return null;
// find renderings with datasources set
var customDataSources = ExtractRenderingDataSourceItems(sitecoreIndexable.Item);
// extract text from data sources
var contentToAdd = customDataSources.SelectMany(GetItemContent).ToList();
if (contentToAdd.Count == 0) return null;
Log.Debug($"[{nameof(DataSourceContentField)}] Item: {sitecoreIndexable.AbsolutePath}, Content: {string.Join(" ", contentToAdd)}", this);
return string.Join(" ", contentToAdd);
}
/// <summary>
/// Finds all renderings on an item's layout details with valid custom data sources set and returns the data source items.
/// </summary>
protected virtual IEnumerable<Item> ExtractRenderingDataSourceItems(Item baseItem)
{
var currentLayoutXml = LayoutField.GetFieldValue(baseItem.Fields[FieldIDs.LayoutField]);
if (string.IsNullOrEmpty(currentLayoutXml)) yield break;
var layout = LayoutDefinition.Parse(currentLayoutXml);
// loop over devices in the rendering
for (var deviceIndex = layout.Devices.Count - 1; deviceIndex >= 0; deviceIndex--)
{
var device = layout.Devices[deviceIndex] as DeviceDefinition;
if (device == null) continue;
// loop over renderings within the device
for (var renderingIndex = device.Renderings.Count - 1; renderingIndex >= 0; renderingIndex--)
{
var rendering = device.Renderings[renderingIndex] as RenderingDefinition;
if (string.IsNullOrWhiteSpace(rendering?.Datasource)) continue;
// if the rendering has a custom data source, we resolve the data source item and place its text fields into the content to add
var dataSource = DataSourceHelper.ResolveDataSource(rendering.Datasource, baseItem);
if (dataSource != baseItem && dataSource.IsDerivedFrom(SupportedTemplates))
{
yield return dataSource;
}
}
}
}
/// <summary>
/// Extracts textual content from an item's fields
/// </summary>
protected virtual IEnumerable<string> GetItemContent(Item dataSource)
{
foreach (Field field in dataSource.Fields)
{
// this check is what Sitecore uses to determine if a field belongs in _content (see LuceneDocumentBuilder.AddField())
if (!IndexOperationsHelper.IsTextField(new SitecoreItemDataField(field))) continue;
var fieldValue = StringUtil.RemoveTags(field.Value ?? string.Empty);
if (!string.IsNullOrWhiteSpace(fieldValue)) yield return fieldValue;
}
}
}
| Definition of content on a page
I have thought about how to best assemble a "page" document in Lucene/Solr to later use in Sitecore when searching for most relevant pages to show to a user.
A page consist of many elements which is typically indexed separately in Sitecore.
How would I best assemble the item that represents a given "page"? As I see it I would need to extract all reference from the actual page item, look up all related items and store their content in the document representing the "page" document.
This seems kind of bulky if that needs to be performed each time a page item is changed.
Seems easier just to crawl all pages the old fashion way.
What is the best solution for indexing whole pages?
| |
Publishing that many items will always be quite slow, there is a lot of reading, writing and indexing that is required however. I don't think there is going to be any code which will solve this.
I've not seem all the jobs disappearing (with the exception of, as you say Sitecore restarting - can you see this happening in the logs?). However there are some Sitecore features that might be able to help outside the scope of code changes:
8.2 Publishing Service module
As I'm sure you already are aware 8.2 has the new Publishing Service module which should stop this being an issue:
"The module answers inherent problems with Publishing large amounts of data (100,000’s of items) across multiple data-centers and geo-graphic locations"
8.1 also has a neat package which (at least in theory) makes the upgrade to 8.2 much more simplistic.
Solutions in 8.1
That said it is still an upgrade and so it will undoubtedly be painful!
From 7.2 onwards you can make it significantly quicker as long as you have some horsepower in your CM server.
Goooo Parallel
Rename the following file
Sitecore.Publishing.Parallel.config.disabled
to
Sitecore.Publishing.Parallel.config
This enables you to change parallel publishing options and takes advantages of all the cores of your server.
<!-- PUBLISHING MAX DEGREE OF PARALLELISM
If set to a positive number, it limits the number of concurrent publishing operations to the set value.
If it is -1, there is no limit on the number of concurrently running operations.
Default value: 1
-->
<setting name="Publishing.MaxDegreeOfParallelism" value="1" />
Publishing Optimisations
Rename:
Sitecore.Publishing.Optimizations.config.example
to
Sitecore.Publishing.Optimizations.config
In here there are a bunch of optimisations you can tweak (and possibly break your site - so go careful), full details are in the references below.
One example is:
Disable Link Database
As mentioned in the article below you can also disable the link database being updated during the publish:
LinkDatabase.UpdateDuringPublish=false
Fast servers...
All these optimisations are reliant on having beefy CM boxes, if they are not full of fast disks and lots of cores then you might not see great improvements.
References
Enabling Parallel Publishing with Sitecore 7.2
Dedicated Publishing Instance Configuration
| Publishing items in bulk
I need to publish around 100K items in Sitecore 8.1 programmatically. They don't have a common parent, they are spread out in several folders but I have their IDs.
I tried using PublishOptions:
Sitecore.Publishing.PublishOptions publishOptions = new Sitecore.Publishing.PublishOptions(item.Database,
Sitecore.Data.Database.GetDatabase("web"),
Sitecore.Publishing.PublishMode.SingleItem,
item.Language,
System.DateTime.Now);
Sitecore.Publishing.Publisher publisher = new Sitecore.Publishing.Publisher(publishOptions);
publisher.Options.RootItem = item;
publisher.Options.Deep = false;
publisher.Publish();
and PublishItem:
PublishManager.PublishItem(item, new Data.Database[] { Sitecore.Data.Database.GetDatabase("web") }, item.Languages, false, false, true);
Of course, each of the above code snippets is surrounded by a foreach.
I'm not sure which is better in theory, but I see that both of them:
Are slow
Create thousands of new publish and indexing jobs
After publishing 20k-30k all jobs disappear as if Sitecore server resets
So am I doing something wrong or is there a better way of doing this?
| |
No, it's not possible without custom code.
And to be honest, I don't think this is really what should come out of the box with Sitecore. Your component uses Datasource Folder item as datasource and that datasource will be published. And it's your own code which takes children of that datasource and uses them to display some content.
That's why I would say that you need to write your own code (or find some existing solution in the net) for publishing those items which are required by your component.
| Issue with publishing "related items" from Experience Editor
I have a Sitecore 8 project where we have created a component for the editors to use.
A component takes Datasource of "Datasource-Folder" with X numbers of "Datasource-Item" below.
The tree looks like this:
Globals
Datasource Folder
Datasource Item1
Datasource Item2
Datasource Item3
Datasource Item4
The user can change and add a datasource item with the Experience Editor.
Now the issue. In the Experience Editor the user can edit the Datasource Item's fields, i.e. he can edit image, text, general link field of this Datasource Item. If they save it I can see saved data in the master database. But when the user is publishing the Context Item from the Experience Editor, then the datasource items are not publishing. Is that a Sitecore bug?
I have also referenced this. But my question is if it's possible without customizing the code?
Thanks in advance.
| |
You can remove access to /sitecore/templates/System/Layout/Rendering Parameters/Standard Rendering Parameters/Caching
Navigate to the item
Open Security tab
Click on Assign button
In the dialog which will appear select user or group (preferably) from whom you would like to hide the section
Remove the inheritance for the item and its descendats
| Locking down Sitecore rendering caching
Sitecore has some lovely granular security permissions that can help us stop users doing things which can break the site, however one thing I can't obviously see is how to limit access to the caching panel on the control properties when adding components to pages.
It's not the end of the world but can access to this be controlled by roles at all?
| |
In my mind, Profiles are like different facets of a users' interaction with a website, and patterns are combinations of values for those facets to form a type of user. A user will build up profile values during their visit to a site depending on how you configure your site. Profiles are made up of profile keys, you can configure your site to score against these keys either using the Content Editor/Experience Editor, or programatically.
I'll try to give an example of profiles and patterns below...
A few examples of profiles would be:
1) You might want a gauge a users engagement level - are they just browsing your site at a very shallow level, or are they deeply interacting with your site, i.e completing forms, using tools, adding products to a basket. This would be your user engagement profile, and different types of pages would score differently against this profile.
2) If your site sells a range of products, you might want to know which particular category of product the user is interested in. This would be your product category profile. Each page hit within a particular product category would score a point against the relevant product category profile key.
3) Finally, again using the example of a site that sells products, you might want to know their budget - what price ranges of products is the user looking at? Are they looking at expensive products in the upper range of your products, or are they looking at the lower range. This would be your budget profile. A user viewing cheaply priced products would have a point scored against the low-end budget profile key within the budget profile.
You can then create patterns that you think users will fit in to. This is akin to a "type" of user. Using a fictitious car manufacturer website, a few examples of patterns would be:
1) Expensive taste / 4x4s / low interest. A user that shows low engagement value because they rarely interact further than viewing top-level pages, but is clearly interested in the more expensive end of the product range.
2) Varied budget / family cars / medium interest. A user that browses family cars in different price brackets, has show medium engagement, for example, user may have browsed quite deeply, and downloaded a brochure.
3) Low budget / small cars / high interest. A user that browses small cars in a low budget sector to a high interest level, possibly completing an enquiry, using a configurator etc.
Once you have created your profiles, tagged all your content and created your patterns, Sitecore will place users in to a pattern in real time. You can then use these patterns to personalise your site to target content at that "type" of user.
I'm sure there are others who can explain more eloquently!
| Sitecore Personalisation - Profiles and Pattern Cards
I'm trying to come up with a good answer to a question I get asked a lot.
Why does Sitecore have both pattern and profile cards?
Outside the standard answer:
profile cards are for tagging content and pattern cards are for visitors
More often than not I see a 1:1 mapping between the two, though I understand this is not always the case.
One example I heard which stuck was:
If you make cars, you might have a red colour profile and a yellow colour profile and tag content accordingly but your pattern card for people looking at red and yellow cars might be flashy colours - is this fundamentally a correct distinction between the two?
Do people usually have a 1:1 mapping between profiles and patterns or do they see them differing?
| |
To be honest, I'm not sure if what I describe below will fix the ASYNC_NETWORK_IO issue. Seeing NETWORK_IO lets me think that the issue is more network or server related than being a real Sitecore issue.
However, we have also seen high loads due to EventQueue table activity. With the help of Sitecore Support we've come to this solution:
Clean EventQueue on CM more frequent:
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<scheduling>
<agent type="Sitecore.Tasks.CleanupEventQueue, Sitecore.Kernel">
<patch:attribute name="interval">00:30:00</patch:attribute>
<DaysToKeep>
<patch:delete />
</DaysToKeep>
<IntervalToKeep>01:00:00</IntervalToKeep>
</agent>
</scheduling>
</sitecore>
</configuration>
On CD, check the EventQueue less frequent and disable the EventQueue cleanup (as it's already been taken care of by the CM):
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<eventing>
<eventQueue>
<processingInterval>00:02:00</processingInterval>
</eventQueue>
</eventing>
<scheduling>
<agent type="Sitecore.Tasks.CleanupEventQueue, Sitecore.Kernel">
<patch:attribute name="interval">00:00:00</patch:attribute>
</agent>
</scheduling>
</sitecore>
</configuration>
Using these values means that published content can take up to 2 minutes before it becomes visible. But it should lower the load on the EventQueue table.
| SQL wait times on EventQueue
Has anyone seen large wait times in SQL Server related to the Event Queue? Specifically, we are seeing ASYNC_NETWORK_IO being reported as a problem when accessing the Event Queue in SQL Server.
We have something like 50+ servers connected to the same core database, I am wondering if the rapid querying by all boxes is causing the issue.
This is using Sitecore 8.1 u3.
| |
Just a thought... Add a hidden textbox as described in the blog post and populate/clear it when the checked state of the checkbox changes. The other way around, check the checkbox if the hidden textbox isn't empty.
| Extending internal General Link dialog with Checkbox in SPEAK
I followed these instructions to add a text field to the internal General Link dialog which works fine.
But now I need a checkbox instead of a text field (anchor) but it still should add a tag with text in the link field like this in raw value view (data-name="teaser_a"):
<link text="Test" data-name="teaser_a" linktype="internal" class="" title="" target="" querystring="" id="{819BFAC1-A563-49DA-9C2C-E88D0B397618}" />
while teaser_a is the item name, which should automatically be added.
So instead of textbox rendering I would add a checkbox rendering to /sitecore/client/Applications/Dialogs/InsertLinkViaTreeDialog layout.
But after that I'm not entirely sure. I'll probably have to update the ReadQueryParamsAndUpdatePlaceholders method in InsertLinkDialogTreePageCode class and somehow get the item name.
The code in the example looks like this:
private void ReadQueryParamsAndUpdatePlaceholders()
{
Original implementation
{
this.Anchor.Parameters["Text"] = GetXmlAttributeValue(element, "anchor");
}
}
And than respectively alter the rule in MakeInternalLinkFromTreeView since it is not a textControl anymore. Code in example:
... anchor target name to [targetAnchorID,,,textControl6]'s text property ...
I'm new to SPEAK and the rule engine. Can someone point me into the right direction?
| |
In the section of your index (<configuration ref="contentSearch/indexConfigurations/defaultLuceneIndexConfiguration" />) you should point towards a custom config instead of the default one. You need to create this config though, and there you can add the computed field.
Here's a blog post describing this: http://ggullentops.blogspot.be/2015/11/sitecore-indexes.html. Depending on your Sitecore version, there might be some changes needed. It comes down to creating your own version of the default so you can take as guidance.
After adding the computedField in a section <fields hint="raw:AddComputedIndexField">.. </fields>, you might need to add it to the fieldMap as well. That is if you need to get your field untokenized or want to define an analyzer on it.
| How do I define a custom computed and tokenized field in my index?
I'm currently working in Sitecore 8.1. I would like to add a custom computed field to a specific index, and only that index. I have been able to add the field globally to Sitecore.ContentSearch.Lucene.DefaultIndexConfiguration.config, but I had to reference a dll that isn't specifically meant to be applied to all indexes.
I have the following index:
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<contentSearch>
<configuration type="Sitecore.ContentSearch.ContentSearchConfiguration, Sitecore.ContentSearch">
<indexes hint="list:AddIndex">
<index id="custom_master_index" type="Sitecore.ContentSearch.LuceneProvider.LuceneIndex, Sitecore.ContentSearch.LuceneProvider">
<param desc="name">$(id)</param>
<param desc="folder">$(id)</param>
<!-- This initializes index property store. Id has to be set to the index id -->
<param desc="propertyStore" ref="contentSearch/indexConfigurations/databasePropertyStore" param1="$(id)" />
<configuration ref="contentSearch/indexConfigurations/defaultLuceneIndexConfiguration" />
<strategies hint="list:AddStrategy">
<!-- NOTE: order of these is controls the execution order -->
<strategy ref="contentSearch/indexConfigurations/indexUpdateStrategies/syncMaster" />
</strategies>
<commitPolicyExecutor type="Sitecore.ContentSearch.CommitPolicyExecutor, Sitecore.ContentSearch">
<policies hint="list:AddCommitPolicy">
<policy type="Sitecore.ContentSearch.TimeIntervalCommitPolicy, Sitecore.ContentSearch" />
</policies>
</commitPolicyExecutor>
<locations hint="list:AddCrawler">
<crawler type="Sitecore.ContentSearch.SitecoreItemCrawler, Sitecore.ContentSearch">
<Database>master</Database>
<Root>/sitecore/content/Home</Root>
</crawler>
</locations>
<enableItemLanguageFallback>false</enableItemLanguageFallback>
<enableFieldLanguageFallback>false</enableFieldLanguageFallback>
</index>
</indexes>
</configuration>
</contentSearch>
</sitecore>
</configuration>
I have tried adding
<fields hint="raw:AddComputedIndexField">
<field fieldName="SearchDate">Project.Web.Search.ComputedFields.SearchDateField, Project.Web</field>
</fields>
to the <configuration> element, but that didn't work. I also tried adding the above to a few other places under this index, but I haven't been able to get it to work anywhere.
Is it possible to do what I'm looking to do? If so, how?
| |
Sitecore doesn't expose the version manager [you've shown] on templates. However, you can use the DB Browser (~/sitecore/admin/dbbrowser.aspx) and manage items, templates, etc. that way. Simply point your browser to http://instance/sitecore/admin/dbbrowser.aspx:
Then navigate to the template you're looking to modify and select the version you're after and select Delete Version:
| How to remove a language version of a data template?
I created German versions of several data templates by accident.
For regular items, there's an option to remove a version at tab "Versions" –> section "Versions":
For templates, though, the whole "Versions" section is missing.
I'd like to remove all template versions that are not English. How do I do that?
| |
So the answer was to remove this NuGet packaged manually by editing the project.json file. Apparently this package is not needed by the solution so removing it was safe. There must be an issue with the package because even when I readded it from NuGet it still errored. Something Sitecore will need to fix.
| NuGet Package reference issue: Sitecore.Serilog.Framework.Logging
Is anyone out there using the Sitecore Commerce 8.2.1 CTP 3 release VM? I am having a NuGet Package reference issue in the Sitecore.Commerce.Plugin.Sample project wondering if anyone has gotten past this:
Error: Unable to resolve 'Sitecore.Serilog.Framework.Logging (>= 1.0.0-alpha7-1019)' for '.NETFramework,Version=v4.5.2'.
| |
You can check the content of your exported package (it might be a problem with export not import).
This error can be caused by:
missing page item in the package (there must be at least one index.html file)
First selected index.html has no information about exported language.
Open your package and if there is a index.html make sure that in the body element in class attribute there is a language information
Example body tag:
<body class="
{71E0EFC2-CC97-4066-B15F-7644972C4EFC}
{en}
{FE5D7FDF-89C0-4D99-9AA3-B5FBD009C9F3}
[Ignore-This] sc81 preview default-device [Ignore-This-End] add-your-css-classes-here">
| SXA - Import Fails Due to Missing Language Information
I've got a simple scenario. I export a site (single page), then try to import the exact same zip file.
I get an error that states:
Could not find language information in the zip file. Please make sure
the package is importable.
I'm running Sitecore 8.2 (rev. 160729)
Any ideas?
| |
I have not attempted this and have no idea how well this would work in practice. It's just an idea.
One way to handle it might be to just use a versioned field with language fallback and then add a customization that restricted editing to the "master language". You could use an item:saving handler to intercept an edit, use the language fallback settings to determine which language the value is coming from and then, create a new numbered version in that language and update the value there.
| Workflow of shared / language-independent fields
Sitecore workflow will only apply to versioned fields, since it works by preventing publishing of unapproved item versions. However what if I have a language-independent field (such as an image, number, or price) which I need to workflow? Are there approaches which allow for approval of changes to such a field, without allowing it to be edited/changed in each language version of the item?
|
Subsets and Splits