29 votes
Accepted

How do I clear the HTML cache for a specific user?

You can do this by making sure that your renderings are set to Vary by User. This adds the user to the cacheKey string like this "_#user:" + Context.GetUserName(); You can then use the following code ...
Richard Seal's user avatar
  • 20.4k
23 votes
Accepted

What is the difference between a Layout, Sublayout, and Rendering?

Layouts Provide the outermost HTML structure of a page. There is one layout (per device) per page. Apply to WebForms (.aspx) and MVC (.cshtml) Comprise of Layout definition item and aspx page (...
Matthew Dresser's user avatar
21 votes
Accepted

How do I implement Accelerated Mobile Pages (AMP) with Sitecore?

Because Sitecore supports server-side responsive rendering, it's very easy to use the Device feature of the CMS to support AMP. AMP Layout (using Razor) This example is adapted from Google's example ...
sitecorerick's user avatar
  • 2,329
20 votes
Accepted

Possible to copy the presentation details of one item to another?

Yes, the presentation values of Item A are stored as an XML construct in the raw values of the Renderings field. You can see that field here: If you follow the blue arrows and click on Raw Values ...
Pete Navarra's user avatar
  • 14.7k
18 votes
Accepted

Is there any alternative to @Html.RenderAction in Sitecore?

If you simply want to render out a partial view (either view rendering or controller rendering), from another view or layout, you could use the Sitecore MVC extension methods: Render view rendering: ...
Søren Engel's user avatar
  • 1,523
17 votes
Accepted

SXA Page Design vs Page Standard Values vs Page Branch Template

With Sitecore Experience Accelerator you can forget about previous methods, however, there is nothing that will block you from using them. Before - NO SXA: you had to decide how your page will look ...
Alan Płócieniak's user avatar
16 votes

Sitecore media ashx not resizing the image (version 7.2)

As of Sitecore 7.5+ (applies to the latest 7.2 versions as well), Sitecore introduced a media request protection for image resizing (to make sure an attacker can't overload your server with image ...
Andrey Bobrov's user avatar
15 votes
Accepted

Relative rendering DataSource Locations

DataSource Location inside rendering parameters has different context. You could achieve your goal by extending resolveRenderingDatasource pipeline. Allows developers to override the default logic ...
Alan Płócieniak's user avatar
15 votes

Possible to copy the presentation details of one item to another?

Yes. Open the presentation details of the item you want to copy from. you will see a link "Copy To" beside "Edit". You can pick which target devices you want and to which item you want to copy the ...
Diego's user avatar
  • 5,688
15 votes
Accepted

What's the Placeholder field used for in a Rendering?

It is a default, used when no placeholder key is given upon inserting the rendering onto the page. This can happen both when editing via Content Editor/Presentation Details or as a result of a ...
Mark Cassidy's user avatar
  • 25.2k
12 votes
Accepted

"Replace Rendering" in Experience Editor disabled

The replace button doesn't appear on Experience Editor in 2 cases : When rendering doesn't have any renderings or sublayouts in Complatible Renderings field. When Renderings or sublayouts are not ...
Vlad Iobagiu's user avatar
  • 18.5k
12 votes
Accepted

Multilist With Search in Rendering Parameters is empty

This is a known bug at Sitecore. We had the same problem and created a Sitecore ticket. Please use the reference number 106439 if you contact them. This is the solution though: I was able to ...
Koen Heye's user avatar
  • 1,626
12 votes
Accepted

Get amount of components on final layout programmatically

This can be done by parsing the layout XML for each field (renderings and final renderings). The key is to use Sitecore.Data.Fields.LayoutField.GetFieldValue in order to obtain the XML value, ...
maz's user avatar
  • 1,813
12 votes
Accepted

Is it possible to get page rendering result programmatically ?

I think AlokBhatt's method is a good start, though I would make use of pipelines throughout. I think this is a better solution because it doesn't involve trying to parse presentation details, and ...
Matthew FitzGerald-Chamberlain's user avatar
12 votes
Accepted

I need to reorder renderings in Presentation Details on all pages

The following example uses Sitecore PowerShell Extensions to change the order of two renderings. The renderings are next to each other, and essentially swap positions. Script # Home Page $item = Get-...
Michael West's user avatar
  • 18.2k
11 votes

Is there any alternative to @Html.RenderAction in Sitecore?

Although .ViewRendering and .Controller will work, there are performance issues with both of those methods. Both methods will bypass Sitecore's output caching mechanism completely, so every page on ...
Richard Seal's user avatar
  • 20.4k
11 votes
Accepted

Is it possible to use conditional renderings with Sitecore MVC

Conditional renderings work fine with MVC. For version 8, you must have Analytics.Enabled set to true so you can get to the personalization section of the presentation. "Global" conditional ...
Richard Seal's user avatar
  • 20.4k
10 votes
Accepted

Item not found when saving page in Experience Editor

So it's took me all of yesterday and most of today to figure this out. In the end it was nothing to do with my code or configuration at all. The log files showing some errors were a Red-Herring and ...
Adam Seabridge's user avatar
10 votes

Possible to copy the presentation details of one item to another?

If you have Sitecore Powershell Extensions installed then there is an OOTB module available to copy/paste renderings between items. Simply right click the item, then select Scripts > Layout > ...
jammykam's user avatar
  • 13.8k
10 votes
Accepted

How can I programmatically list all personalization in my page?

You can get the personalization from the renderings field. If you open an item that contains personalization you will notice on the renderings field in Raw mode something like this: <rls><...
Diego's user avatar
  • 5,688
10 votes
Accepted

Edit a Sitecore item in memory only

Don't overwrite the Sitecore.Context item with the one you are fetching for the wildcard. Keep the wildcard item as the context item. Instead, put the product item in a sort of wildcard context. You ...
Bart Verdonck's user avatar
9 votes
Accepted

Programmatically add log information in all renderings (controller, view) HTML

Yes, you can do it by the following way. Configuration: <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"> <sitecore> <pipelines> <mvc.renderRendering&...
Tamás Tárnok's user avatar
9 votes

How can I edit rendering parameters programatically?

Got the answer, here is the complete code. In my case I'm updating the Display Subtitle field but you can change this field or make the field name a variable if you want to: public void ...
Erica Stockwell-Alpert's user avatar
8 votes
Accepted

Which Sitecore fields can be rendered using a FieldRenderer

You could create a function that checks the fieldtypes.. based on the renderField pipeline, which is executed in the fieldRenderer you should include these types: rich text single-line text text ...
Gatogordo's user avatar
  • 20.1k
8 votes

Which Sitecore fields can be rendered using a FieldRenderer

Every field can be passed through FieldRenderer. The <sc:FieldRenderer> control makes use of the FieldRenderer.Render static method, which can be used on any field. FieldRenderer.Render passes ...
zzzzBov's user avatar
  • 873
8 votes

How can you get a unique ID for a rendering on a specific Sitecore item?

The solution that ended up working for me was to use the DeviceDefinition.GetRenderingByUniqueId method with the RenderingReference.UniqueID object: foreach (RenderingReference renderingReference in ...
Ed Schwehm's user avatar
  • 3,036
8 votes
Accepted

Benefits of static vs dynamic binding of renderings

What is static- and dynamic bindings in general? Static binding means adding a rendering to a page in a raw way, e.g. in an mvc view: @Html().RenderAction("Controller", "Action"); ...
Andrey Bobrov's user avatar
8 votes
Accepted

Is it possible to show the website for a given device?

The Experience Editor (previously Page Editor) allows you to switch between devices. Also for the Preview mode. Ribbon > Experience > Click on current device > Select preferred device
Dražen Janjiček's user avatar
8 votes
Accepted

Force shared layout in experience editor

http://jockstothecore.com/defaulting-shared-layout-editing-sitecore-8-1/ A simple setting is not available, but in the blog post above you can find code for a custom processor for the loggedin ...
Gatogordo's user avatar
  • 20.1k
8 votes
Accepted

Yellow screen (YSOD) and unhelpful errors when trying to edit the renderings/presentation details on a page

I have been able to replicate the error you are having. The reason is because the placeholder are left blank. For example, I have this xml for the Shared Layout: <r xmlns:xsd="http://www.w3.org/...
Hishaam Namooya's user avatar

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