Sitecore 10 .NET Developer Certification Exam Flashcards
How do you patch in changes to the sitecore section of Web.config?
Put a .config patch file in the /App_Config/Include folder.
How are component parameters stored in the Sitecore database?
As clear text in URL query string format.
How can you retrieve the datasource in a view rendering with the default model?
Model.Item
With a particular rendering an editor can only select items of one particular content type. How can this be achieved?
By setting the template ID into the Data Source template field.
An author adds a component to a page in the Experience Editor and then selects the Associated Content dialog box. What triggers this behaviour?
The component’s Datasource Location field is filled in.
What property will automatically prompt a user to choose a datasource when adding a component in the Experience Editor?
Datasource Location
How can you force a Sitecore control to output the content of an item’s datasource?
Set the datasource or item property.
How can you restrict authors to specific types of item for a component’s datasource?
Add the data template to the component’s Datasource Template field.
Why would you set the component on the Standard Values and override the datasource on the items?
When your component has to appear on every page but has a different datasource for a particular page.
What should you use if you want a Title field to be filled with the name of the item on item creation?
Use the $name token on the Standard Values of that template.
When you add @Html.Sitecore().Placeholder(“main”) to your rendering, what do you need to do to make the placeholder selectable in the Experience Editor?
Create a Placeholder Settings definition item.
Why must you create a corresponding Placeholder Settings item in the Sitecore environment after declaring a placeholder in the code of a layout/component?
A Placeholder Settings item is necessary for the placeholder to be accessible and used in the Experience Editor.
Can you use placeholders inside of placeholders?
Not directly, but you can have components inside a placeholder that define other placeholders. They are referred to as nested placeholders.
Dynamic placeholders have a unique ID assigned when they appear on a page created from the original placeholder key. Which is the appropriate format for the unique ID?
Key-#-{GUID}
What happens if allowed controls are not specified on a Placeholder Settings item?
In the Experience Editor, the user will be able to add any component to the placeholder.
What is the purpose of the Standard Values of a template?
To provide a default value when the item is created or to have a fallback when a field has NULL value.
Which of the following options is essential for defining default values and for setting default configurations (Insert Options, Presentation Details etc.) on a template?
Standard Values
Why would you need to use the data source in a component?
Data source allows you to build more flexible and reusable components, because the data source is determined by users and not hardcoded by developers.
How would you show a toolbar in a random part of the page?
Using an Edit Frame.
What template must be used as a base template for your Paramaters template?
The Standard Rendering Parameters template.
You have created a new Parameters template. How do you ensure your component uses it?
Through the component’s definition item in the Parameters template field.
What is the default model used by view renderings and optionally by controller renderings?
RenderingModel
Which of the following view types can be used to render HTML output within another view’s rendered output?
Partial views
What two other terms have the same meaning as component?
- Rendering
- Control
What are the two types of file needed for a model-bound component?
- Model.cs
- View.cshtml
What would be a good reason for using a custom view component rather than a model-bound view component?
The site needs a component that will integrate with a third-party source for content.
You’ve been asked to ensure users can easily swap out a promotion component with an alternative component option that has no image when used in a smaller space on a page. How would you make the distinction that these two components are interchangeable?
By using compatible renderings in the component definition item.
What should you keep in mind when configuring compatible renderings?
They should be set on both components so you can exchange them. Both need to be in the Allowed Controls for any placeholders they will appear in. They may need to share data source and parameters.
Which type of component would you create if you wanted to closely follow MVC patterns or invoke complex logic?
Controller rendering
How do you bind a controller to deal with the post of a view rendering?
By filling the Form Controller Name and Form Controller Action fields in the definition item of the view rendering.
What method do you need to invoke inside a view rendering form to ensure only its controller reacts to the post?
@Html.Sitecore().FormHandler()
In a view, what do you need to do so the Field() extension method retrieves the content from the data source?
Nothing, it’s its default behaviour.
What can be the reason $token is visible in one of the items as “$token” and not replaced with its value?
$token will replace by value for newly created items, not existing ones.
Which of the image properties allows you to specify how much space should be placed around the image?
The Space section.
Why is there a master and a web database?
It allows content to be edited without affecting the live data/website.
Why should you not directly edit in the web database?
Because on the next master publish the content will be overwritten.
A single item needs to be published. What two features do you use?
- Content Editor
- Experience Editor
You have just created new content but you can’t see it on your live website. Why not?
You need to publish new/edited content.
A new Sitecore developer wants to know the difference between web and master databases. Which of the following best describes the difference?
The master database contains all versions of all the content (including unpublished content), while the web database contains only content that is live on the site.
Why is storing media in the Sitecore database an advantage?
It makes publishing easier because the item and the media are both published, so you don’t have to keep files in sync.
If you set up some publishing restrictions, will Sitecore automatically publish that content at the same time?
No, the publishing restrictions only dictate when an item or its versions are publishable or not.
Why should you not add Presentation Details on every new content item?
Use Standard Values of the template so that every item based on this template will have the same layout.
The customer wants to temporarily change the layout of a homepage. Which feature of Sitecore should make this possible?
Versioned layouts
A new Sitecore developer says they want to start to build out the general structure of the rendered appearence of a webpage. What are they describing?
Layout
What is mandatory for Presentation Details?
Layout
What do you at least need to create a layout?
- .cshtml file
- Layout item
Describe the anatomy of a Sitecore layout.
A code file in the file system and a definition item in the content tree.
How is the layout file linked to the definition item?
By the Path field on the definition item.
What is the difference between Shared and Final layouts?
- Shared: Controls added in the layout are shared in all languages and numbered versions
- Final: Changes made in the layout are specific to that language and version
What happens when you request a page that has no layout defined in the Presentation Details?
Sitecore shows a “layout not found” error page.
Can you edit an item in the Experience Editor when the item has no Presentation Details set?
No, since it can’t be presented.
How do you address a placeholder?
By using the placeholder key.
How do you specify a static component in a .cshtml file?
@Html.Sitecore().Renderings(“Path or ID”)
How do you render the content of a single line text field called Title?
@Html.Sitecore().Field(“Title”)
What is the advantage of using components?
Your presentation artifacts are more reusable.
You want to ensure headers and footers are always visible on your Main layout. Will you statically or dynamically bind it?
Statically bind it when you need it to always appear on a layout or rendering.
What must you do to ensure a controller rendering can be inserted into a placeholder on your site page?
Add the controller rendering to the placeholder settings of that placeholder.
What is the purpose of a dynamic placeholder?
To apply the same placeholder multiple times with different renderings in it.
In Sitecore MVC, how do you make a field non-editable?
By setting DisableWebEdit to true.
A placeholder is defined in code but not visible in the Experience Editor. What is most likely the cause?
- Placeholder Settings item has to be created
- Placeholder should be added to the Presentation Details
How to optimize the process for an author to prevent removing renderings if they just want to switch the view of a component?
Add a rendering to compatible renderings.
How do you create a component that can’t be edited in the Experience Editor?
Use static component binding.
What do you need to create when you have a view rendering?
Razor view
If you want to have reusable elements in your layout, what kind of view should you create?
Partial view
Which .dll relates to presentation? Which dll is required to get RenderingContext?
Sitecore.Mvc.dll
How do you access the HTTP request properties?
Sitecore.Context.Request
What of these properties are available in the Sitecore.Context class?
- User
- Database
- Language
How would you display the direct children of the Home item?
- Retrieve the Home item using Sitecore.Context.Site.StartPath
- Use GetChildren() method
What is the danger of using a method like Axes.GetDescendants()?
It retrieves recursively all children of all children of the item. If invoked in an item near the root it would load the entire tree in memory, with the corresponding performance penalty.
How do you get the children items of an item?
- .Children
- .GetChildren()
What is the difference between GetChildren() and GetDescendants()?
- GetChildren: Returns all direct children of an item
- GetDescendants: Return all items under an item
How can you populate the property of a ViewModel and still support inline editing in the Experience Editor?
By using the Render() method in the FieldRenderer class.
How do you put an item into the Editing state?
By creating an Edit Context.
What methods do you invoke when you begin and finish editing an item through the API?
- .Editing.BeginEdit()
- .Editing.EndEdit()
Why would you preferably avoid sorting items in the code (LINQ etc.)?
It might confuse the authors to see items appear in different order to the order shown in the Content Editor.
How can you skip certain items when you build the navigation?
Use LINQ to filter by template or value of specific fields.
How can you run part of your code with a set of privileges different from those of the context user?
- UserSwitcher
- SecurityDisabler
What two core services conform to the Sitecore Services Client?
- ItemService - Access to regular Sitecore items
- EntityService - Access to business objects
What is an item bucket?
A container that allows you to hide innumerable items within, while still being easily retrievable.
How do you find items in buckets?
Content Search API
Why would an item show in the content tree even though it is a child of a bucketed item?
It’s not bucketable.
What part of Sitecore is in charge of generating URLs?
LinkManager
Where can you customize how URLs are rendered globally?
In the LinkManager section of the Web.config.
How can you get Sitecore to produce translated URLs?
By setting the LinkManager to use the item’s Display name.
Why is it important to have friendly structures within your content tree?
Because they dictate the segments within your URLs.
In which situations would you want to change the links generated for an individual link?
If you need to force the language of content that is to be rendered from Sitecore.
How can you globally change characters in the URLs that are generated and resolved from Sitecore?
Using the encodeNameReplacements option in the Web.config.
How would you disable .aspx being added to all URLs that are generated from Sitecore?
By changing the addAspxExtension attribute of the LinkManager.
How would an author cause a broken link when renaming an item?
The URL is usually made using item names. If the page was bookmarked in the browser, it will no longer work. You will need to implement 301 redirect logic.
Why should you never cache a component that displays personal information?
Another visitor to your site could see that information.
Which of the following commands is used to enable caching for a site?
cachehtml = “true”
What kind of information is stored in the Prefetch cache in Sitecore?
Items that Sitecore will need to access during and just after initialization of the instance.
Why would your team decide to disable the Prefetch cache in your Sitecore solution?
The cycle of continuous caching and the prefetching of too many items will increase the load on the SQL server and may degrade the startup time of your application.
You have a component you would like cached anywhere it is used. Where would you define its cache settings?
On the component definition item in the Sitecore tree.
You have a component that you want cached on every Event Details page. Where would you define its cache settings?
On the component on the Event Details template’s Standard Values item.
How are workflows defined?
Through definition items under /sitecore/settings/workflow.
How do you bind a particular workflow with a certain type of item?
By setting the initial workflow in the template’s Standard Values.
What are some advantages of using workflows?
- Acquire content approval
- Prevent unwanted publishing
- Automatic numbered versioning
- Content testing
- Publishing to a preview target
What are the two consequences of making a state Final?
- Items in it can be published
- Sitecore creates a new version when a non-admin user tries to edit it
What can you find in the workbox?
Available commands on items grouped by workflow.
What is the point of the Write access right state?
To override the Write Permission for an item while it’s in a particular state.
What is the purpose of the extranet domain?
To provide access to the website for specific roles and users.
A user has been locked out by multiple login attempts using the wrong password. How should you resolve this?
Use the Unlock button in the User Manager.
What is the best practice for setting permissions for a user?
Create roles and assign users to them.
A user is assigned to a role and suddenly has no access to content that was previously available. What happened?
The new role has explicit access denied for that content, which overrides the granted access of the other roles.
Which roles access right will take precedence?
deny
What are the two types of accounts?
- Users
- Roles
Name some Sitecore Security Apps.
- Access Viewer
- Security Editor
- Role Manager
- User Manager
Which user is bound to unauthenticated requests to the frontend website?
extranet\Anonymous
What role does a user need to be able to log in to the Sitecore backend?
Sitecore Client Users
Can you assign a user to a role from a different domain?
Yes