Tips on Adding BrainJocks SCORE to an Existing Solution
BrainJocks SCORE, BrainJocks SCORE UI and BrainJocks SCORE Bootstrap UI can be added to an existing solution.
Because BrainJocks SCORE is designed to be multi-tenant friendly, there are certain things that need to be done to the page types and the site structure for SCORE to function properly.
Step 1. Download Score Library
SCORE consists of 3 parts - Score, Score UI and Score BootstrapUI. Download instructions and link are available here.
Step 2. Add Score License
Add provided/trial Score license to your ../Website/App_Data folder. If the folder does not exist, go ahead and create it. Add the license and recycle your application pool.
Verify Score installation by loading below in your URLs
URL | Sample Outcome |
---|---|
http://<your-site>/score/about/version | |
http://<your-site>/scoreui/about/version | |
http://<your-site>/scorebootstrapui/about/version |
Step 3. Website Root Item, Selections, Keywords, Settings and Facets
The Website Root Item has to be of a certain template for relative queries to work correctly.
The Site Root Item (it's
rootPath
in the<site>
config entry) should be of template/sitecore/templates/Score/Base/Website Root
({1469DFF6-C07C-4EAA-9E07-2D42D996E57E})
An easy way to create the website content root, site selection folders keywords folder, etc. is to use the BrainJocks SCORE Bootstrap UI branch template located at /sitecore/templates/branches/BootstrapUI/BootstrapUI Website
then add in your existing content.
- Use the site branch template located at
/sitecore/templates/Branches/BootstrapUI/BootstrapUI Website
and create a new temporary site. - Then copy the scaffolded shared content structure to your existing site
Step 4. Page Type Inheritance
First and foremost, all page types that want to use SCORE functionality must inherit from the proper BrainJocks SCORE base templates. Many SCORE features are scoped to the page types and won't work if a page is not of the right type. Thanks to multiple inheritance of templates in Sitecore the existing pages just need to add one more base template to the list:
- Home Page should inherit from
/sitecore/Templates/Score/Pages/Site Home Page
- Other content pages should inherit from
/sitecore/Templates/Score/Pages/Site Content Page
- If you want to use SCORE navigation components, pages types should also inherit from
/sitecore/Templates/Score/Navigation/Navigable
and pages types other than the home page should inherit from/sitecore/Templates/Score/Navigation/Section Navigation
- If you want to use the SCORE meta data support for your pages, all page types should also inherit from
/sitecore/Templates/Score/Meta Data/Page Meta Data
- If you want to use the SCORE script support to embed JavaScript blocks into the head or foot of a page, the home page should inherit from
/sitecore/Templates/Score/Scripts/Site Scripts
and all pages should inherit from/sitecore/Templates/Score/Scripts/Page Scripts
If you want to use the SCORE search support for your pages, all page types should also inherit from
/sitecore/Templates/Score/Content Search/Searchable Page
Step 5. Support for Snippets
In order to use snippets your site should:
- Include a page type that derives from the Score's base Snippet type located at
/sitecore/templates/Score/Base/Snippet
Next, you need to create a Standard Values item for the page type, and open the Presentation Details of the page type. It should look like this.
Step 5. Rules for Shared Content, support for Template Editing, and Snippets
SCORE uses rules to help isolate assets that are needed for tenant support. There are 3 rules that you will need to add when setting up a tenant.
Rule Path | Rule | Display |
---|---|---|
Create a new rule /sitecore/system/Settings/Rules/Get Lookup Source Item/Rules/<Tenant Area> Fields Source | (Highlighted lines are optional for Single site configurations) Rule name - Site Selections Condition where the query contains #selections# Action remove #selections#
Rule name - Site Keywords Condition where the query contains #keywords# Action remove #keywords# Rule name - Site Settings Condition where the query contains #settings# Action remove #settings#
Rule name - Site Search Facets Condition where the query contains #facets# Action remove #facets#
Rule name - Site Templates Condition where the query contains #page-templates# Action replace #page-templates# with path to Tenant Pages Templates (/sitecore/templates/<Tenant Area>/Pages) | |
Create a new rule /sitecore/system/Settings/Rules/Templates Location/Rules/<Tenant Area> Templates Location | Rule name - MySite Templates Location Condition where the item is the Tenant Website Home Page (/sitecore/content/*[@@templatename = 'Website Root']/home) item or one of its descendants Action add Tenant Templates (/sitecore/templates/<Tenant Area>) as a template folder
| |
Create a new rule /sitecore/system/Settings/Rules/Component Datasource Location/Rules/<Tenant Area> Datasource Location | Rule name - MySite Datasource Location Condition where the item is the Tenant Website Home Page(/sitecore/content/*[@@templatename = 'Website Root']/Home) item or one of its descendants Action add Tenant Website(/sitecore/content/*[@@templatename = 'Website Root']) as a datasource root folder for tenant site-shared content
|
To get more information about BrainJocks SCORE rules engine you should study the default rules and determine if you need to create the same for your website. See Rules Created by Scaffolding.
Step 5. Placeholder Settings
You won't be able to use BrainJocks SCORE components unless you enable them on your page types via placeholder settings. This includes the Snippet page type you already created.
There are many way to go about creating your own placeholder settings items, but the easiest would probably be to:
- Use branch template to create pre-set placeholder settings definition items (the template is at
/sitecore/templates/Branches/BootstrapUI/BootstrapUI Placeholder Settings Folder
) - Associate placeholder settings with the placeholder keys on your page types (in standard values) or globally
You can study the default placeholder key assignments for the BootstrapUI component module in the document Component Placeholder Key Reference.
Step 6. Layout Document Considerations
You will need to make sure your layout document(s) bring in required scripts for different modes (e.g. Editing in Page Editor and normal rendering). I suggest you inspect the scaffolded .cshtml
views and cherry pick what you need.