Showing posts with label Tridion. Show all posts
Showing posts with label Tridion. Show all posts

February 14, 2018

Publish Settings in DXA explained

DXA has few system pages like Html-design, _navigation and “Publish Settings”, out of these Publish Settings is the one which boots an DXA application and considered as the very important system page.
Publish setting provides intelligence to the MVC application to get it work faster and isolated from CMS.
How does it choose what to publish?
So DXA provides a schema called Module Configuration. Whenever a module is created, a component of this schema is created you define the module name, version and related dependencies of it.

Whenever Publish-settings is published. It searches for the all components created with this schema
& generate files which store as binaries in the Broker DB. Above picture is of Core component (Module-Configuration schema). If you see it has listed configuration and Resource dependencies of this module.
Files Generated –  (each files starts with its module name)
/System/config
-          Core.json  - Contains all the configuration values(combined)  from attached components above
-          Core.schemas.json – contains name and id of all the schema of this module
-          Core.taxonomies.json – contain all taxonomies of the system.
There is another file _all.json in this directory which actually list all above files and few other environment settings.
/System/Resources
-          Core.json – a combined file of the entire resource component attached in module configuration.
/System/Mappings
We can say it is master data of schemas & templates, this is not module dependent files but global files.
-          Schemas.json - it contains all the schemas’ definitions from the CMS.
-          Regions.json - it has details of all the regions and details of component template where it’s used, along with linked schema of CT.
-          Includes.json – it contains all the Page Template Ids and associated includes in that PT.
So lots of information required/used by DXA for various purposes.
It needs schemas. Json to map field values to the respective entity, Semantics and XPM in MVC application. So whenever there is change in schema you have to publish “Publish settings” page to reflect the change in application.
Some Tips:
Any change in schema CT’s Region and PT’s includes require users to publish this page. Otherwise you will spend hours to figure out where the heck are my changes.
When DXA boots it loads _all.json of config and resources to read all the respective files and download all these under BinaryData folder of your application’ root directory.


January 22, 2018

Semantic markup using Schema.org in DXA

What is Semantic SEO:  Semantic SEO is giving meaning to your  data embedded in the html Tags using some metadata. and which would be utilized by the search engine to index your page in better way.

Why do i care: Semantic SEO is hot topic these days because Google and other Search engine have updated their algorithm to consider and give little higher weight to pages having  semantic markups. It seems inevitable that including semantic mark-up tags in your html will become more important,  check this: Schema mark-up rank higher in SERP’s.

What is Schema.org
Schema.org  provides vocabulary to give semantics to your html tags , which is supported by  Google & Bing. You can find out schema from schema.org for your particular entity and tag the content with that to give it a meaning.
schema.org standards allows specified entities such as products, places or people to be identified in your HTML with different attributes.

Example: Markup with semantic attributes

<div prefix="s: http://schema.org" typeof="s:Movie">
<h1  property="s:name">Avatar</h1>
  <span  property="s:genre">Science fiction</span>
</div>

On inspecting above tags, you will find out above details have been given meaning by adding those attributes (bold). so without this any search engine can't distinguish between what is above information exactly. Now Search engine knows its A movie which has name Avatar, and its a Sci fiction.

Without semantics Google may have index it as book, some mythological character etc. but now its has specific meaning and that's the purpose of Semantics SEO and Schema.org.

Formats: Schema.org just provided the vocabulary or schema to give meaning to your information, but hows this vocabulary is attached to content is , where format comes to the picture.
following are the main formats using which we can tag our content.


DXA and Semantic SEO : 
DXA makes life very easy for us to add those ugly semantics markups into your html tags. Its very good feature which comes OOTB in the DXA all version.

DXA default Implementation: DXA comes with RDFa Lite implementation.  RDFa Lite consists of five simple attributes; vocab, typeof, property, resource, and prefix. so its lite version of RDFa which i mentioned in the list above.
if you want to use any of other format in your code, then you have to implement it.

[SemanticEntity(Vocab = "http://schema.org", EntityName = "Movie", Prefix = "s", Public = true)]
    public class Movie: EntityBase
    {
        [SemanticProperty("s:name")]
        public string Name { get; set; }
         [SemanticProperty("s:genre")]
        public string Genre { get; set; }
    }

SemanticEntity -:  This attribute actually defines which Vocabulary you are going to use
EntityName: Entity name from specified Vocab. Name is one of schema in Schema.org
Prefix: kind of namespace. so if you define multiple formats , Vocab on the it. it would help to differentiate.
Public=true/false:  Semantic attributes will only be applied to markup if Public=true, otherwise it will be ignored.
SemanticProperty: Name of  Entity properties has to match with the name defined in schema.org/Movie only then it will add meaning and will be used by Google to index.

<div @Markup.Entity(Model)>
  <h1 @Markup.Property(Model, "Name")>@Model.Name</h1>
   <span @Markup.Property(Model, "Genre")>@Model.Genre</span>
</div>

so when this is executed, it will give output  as shown above.

Semantics markup Validation using Google structure testing tool; developers.google.com/structured-data/testing-tool/


December 19, 2016

Social connect Module for Dxa - Internals - Part 2

Social connect Module was developed using Microsoft's OWIN implementation, which actually make it easy to write code.

Nuget packages

 <package id="Microsoft.Owin" version="3.0.1" targetFramework="net45" />  
  <package id="Microsoft.Owin.Host.SystemWeb" version="3.0.1" targetFramework="net45" />
  <package id="Microsoft.Owin.Security" version="3.0.1" targetFramework="net45" />
  <package id="Microsoft.Owin.Security.Cookies" version="3.0.1" targetFramework="net45" />
  <package id="Microsoft.Owin.Security.Facebook" version="3.0.1" targetFramework="net45" />
  <package id="Microsoft.Owin.Security.Google" version="3.0.1" targetFramework="net45" />
  <package id="Microsoft.Owin.Security.OAuth" version="2.1.0" targetFramework="net45" />

Startup.cs
This is most important file of the module. it plugs the module in mvc lifecycle to ensure user is logged in and prompt whenever required for login.

 [assembly: OwinStartup(typeof(Sdl.Web.Modules.Social.Startup))]  

startup.cs has method ConfigureAuth which has responsibility to Register Social networks and add required claims to be returned by the respective social network.

upto now, no Dxa involvement was required but now will start integrating Dxa step by step.

SocialController :
This controller acts as main interaction of the system. it triggers following as per the Component template of the module

  • Show the Social network options to user
  • Trigger required social network to prompt for credentials
  • Receive token from Social network to validate it & Read the claims and show log out options.
  • Log outs from system

for above 4 set of activities we need different Component templates.








For last three activities three different pages have been created so that only specified activity is triggered as per the need of user. First activity is part of Header page.






If you need to retrieve authentication status or User information following can be used.

  • Request.IsAuthenticated
  • User.Identity.GetUserName()

December 15, 2016

Packaging an SDL DXA Custom Module

SDL has provided good API's to develop an DXA module. I have recently published two modules


  • JwPlayer Module
  • Social Connect/Login Module (updated)
Though creation of module is of medium complexity but packaging of module is also not easy. so i had hard time initially packaging a module. 

Packaging essentially means providing CMS and CD part in one zip file with respective power-shell scripts to automate the installation on CMS(via calling core Service) and deploying the necessary files on the website. 

CM Part- CM part is where building blocks along with required components, content porter package is created. it has three parts

  •  Import Export folder - Where SDL provided Dlls and powershell scripts are kept which helps in importing the module.
  • Content Porter Package -  To Export content porter package
    • Do not select dependencies
    • Select all required component and pages at website publication only, with setting select folder and all children. in this way only small package with required items will be created.
  • Custom Export Power shell script
    • Download some existing DXA module
    • Take script of that
    • and do required modifications
CD Part - 
  • Copy your Area and respective views
  • Copy required dll into Bin folder
  • Use existing power-shell script from some module
  • if you have custom setting like. web.config to update etc. then write the required power-shell script. refer my social login module for that. 
now try above and zip it for delivery.

Social connect module for DXA - Part 1

 recently published Social Connect module for Digital Experience Accelerator. which extends Dxa to login using social network.

Currently this module supports two social networks
  • Facebook
  • Google Plus
but i will try to add Twitter and linked-in later.

After installing this module you will find login link on your Dxa menu.
 
After click on the Login link you should find below option to select.
After clicking on above e.g Facebook. Facebook will ask for Credentials to enter. after successfully validating. Facebook will return back to Dxa application with token and other details in form of claims. 

Custom modules will receive inputs from the Facebook and accordingly update the UI with logged in name and logout link.


Similarly when after clicking on Google, it will take you to Google login and ask for credentials and OTP. and take back to application with claims. claims are processed and use is logged in.

To achieve above there are few settings to be done at Facebook and Google console where return URL etc are returned

Google requires to create credentials at https://console.developers.google.com
  • Create Auth 2.0 Client-id
  • Give it a name, 
  • Mention Return URL of your application, which will receive the token after successfully authenticated by Google.
  • for Google default URL will always be http://your-domain/signin-google.

I tried to have other endpoint as well but did not work for me so i kept default Url for my testing.



Similarly for Facebook you have to create new App and provide your site's Domain and URL. it will also redirect on your siteurl on a default page with name: /signin-facebook again Owin automatically intercept this and accordingly validate the token and proceed to next steps.


November 29, 2016

Topology manager Tips and Tricks

While working on Web 8 from last 7 months i have few tricks to share

Register multiple Url for single websites : While in development here are various scenarios where we need multiple domain url for the website.

e.g Mobile testing, as we mock the url using IIS host entry, but it does not work on Android and IOS very well, so we have to test on IP on those devices.

Another case when multiple CMS developer working on their on their own DXA copy and they need separate URL for developer's local websites.

With following command you can register multiple Urls for same website.

 PS C:\Windows\system32> Set-TtmWebsite -id Website1 -BaseUrls 
"http://local.stage.test.com", "http://stage.test.com"  

Change Topology Manager database: I changed my VM machine's Server name and suddenly Tridion stopped working. now i have to update server name everywhere in the system from CM to CD. it took me 2-3 days to find out all the instances where Server name was referred.  but still i could not figured out topology manger database reference, then after wasting lots of time i figured out TM's connection string with server-name is embedded in the web.config in encrypted form.

Use following commands to change server name/database of Topology manager. take backup of the web.config file of your Topology manager website, and decrypt it using following command then change the connection string and encrypt it again.

Take backup of your config first

Decryption command
 C:\Windows\Microsoft.NET\Framework64\v4.0.30319>aspnet_regiis -pdf "database" "C  
 :\Program Files (x86)\SDL Web\TopologyManager\web"  

Encryption command
 C:\Windows\Microsoft.NET\Framework64\v4.0.30319>aspnet_regiis -pef "database" "C  
 :\Program Files (x86)\SDL Web\TopologyManager\web"  

November 18, 2016

Sdl Web 8 Dxa Installation - Content Delivery

Content Delivery installation requires few services to be installed and configured. SDL also introduced all new Discovery Service in the web 8 which acts as gateway for all the CD services.
Please find below Different services to be installed.
  • Content/Session-enabled Content Service
  • Content Deployer Service
  • Preview Service
  • Context Service
  • Discovery Service

Content/Session-enabled Content Service
if staging environment,  where XPM etc is enabled, is being configured only Session-Enabled content service is required to be installed and configured. other Content Service is not required to be installed.

Content Deployer Service: Pre web-8 separate http-upload website was hosted on IIS, but with web 8 deployer windows service itself host the required service to deploy the content. Installation is pretty state-forward, just follow the steps mentioned in installation document

Discovery Service 

Once all the above services are installed now you can registered these capabilities into the Discovery Service Registered these capabilities into Discovery Service using Discovery Service registration command.

The discovery service cd_storage_conf config file should have the service entries as shown below.

When you install discovery service, Separate database is recommended for it. This database share same structure as content database but purpose is to keep discovery information separately. 

Run power shell and execute following command

 java -jar discovery-registration.jar update  

This command will update the Discovery database with latest values from cd_storage_conf file. basically it will register the services with different capabilities defined in storage config file.

Discovery Service become gateway service for all the installed capabilitiy. e.g earlier we used to configure http-upload endpoint in the CMS, which actually was source of lots of error when CMS db was backed up from live to UAT etc.

but now Discovery service is registered in CMS, so when something is published request goes to discovery service, its checks whether it has that deploying capability or not. if yes it pass the torch to Content-Deployer and subsequent request goes to Content deployer directly.

Same case with content service etc.

so your ports etc for all the services should be open for your website. e.g you have local sanddbox for DXA and content service is installed at 8089 port. 8089 port should also be accessible at your website box because after discovery resolve the dependency then direct communication between service happens.

October 28, 2016

Custom Dxa Modules Creation - Presentation

SDL Web 8 Developer Summit  2016 was second event in India and was really enjoyed by 50+ Audience including few Mvps including Nuno and Bart. Two days event was a great success.

All the goodies were great especially Pen drive.

I presented step by step way to create Dxa modules. which was really appreciated by all especially Nuno. I am sharing here my slides below for benefits of others. We will come with next season of summit next year as well.



October 18, 2016

Content Type Basics - Web 8 XPM

Content Type - It is predefined Component presentation that can be added to a Page using Experience Manager if that Component type is allowed on particular Page Template.

How to create  - Go to publication Property on the tab "Content type", at bottom click on Insert. you will see following form on the screen.


Already defined component presentation on a page automatically become content type for that page.

All the fields are very descriptive itself.  Define you content type at some common publication 
e.g Website Site Master. so that it gets available to all the site publication in XPM.

Settings:
There are two types of settings in Content Type:
  • Blueprint Context Setting
  • Content type mapping Setting
Blueprint context Settings: Here we define if  a component for is created for a page in any publication what should be physical location of that component. as pages and components are created in different publications.
Just choose the publication here.
Content Type Mapping: In this mapping we basically specify mapping between Page template and Content type. e.g Carousel content type should only be available on Article and home page template

So you can do this setting on parent publication and post that. its get available to all child publication. 

Because "Inherit setting from Parent" is selected by default on all publications. so this setting get automatically available to all child publications. if you wan to override these settings, you can un-check the check-box and define new setting for that required publication.

Here you see all content type available in choose publication. here you can define what all Content type are available to which page template


Content type usage in XPM

After defining the content type, time to use it on desired pages. So load the XPM with the target page where you need to insert the content. when page loads. make sure lock sign in not there on top of the page. else you will not see options under Insert Content, as shown below


when you load a page in Xpm, and select Create and insert New Content option, on left side slider all content type enabled(which we did in last steps) on that PT is shown here. You choose it and it show you form to give a name to the component and choose the folder of that component, if you want to go ahead with earlier selected location that is also OK.

Publication for the component is chosen as per the blueprint context you set in settings.

Some issue exists in Content type
  1. Only first level of components are cloned in content types any linked component is not cloned but same component is used.
  2. When we create Content-type and choose folder location, it does not pick the blueprint context but show the folder from that publication only.
    but when you create component in XPM publication and folders are selected as per blueprint context. if folder choose at creation of content type not exists in the publication as per blueprint context, XPM throws Error.

October 14, 2016

SDL Web 8 & DXA Installation - CM

To install typical DXA and Web 8 copy , following are the essential steps.
  • CM Installation
    1. Database setup (run database Power-Shell scripts)
    2. CMS installation (run the execute table file)
    3. Configure Topology Manager (First we need to install the CD services)
  • CD Installation
    1. Install all the content delivery services (windows service).
    2. Registered these capabilities into Discovery Service using Discovery Service registration command.
  • DXA Installation on CM server 
    1. Import DXA into the Content Manager
    2. Publish the Example Site (or at least a minimal set of Content Manager items) to get the Web site content into the Content Data Store from where it can be retrieved by the Web application on page request
  • DXA Installation on CD server
    1. Install/Host DXA web application by running the PS script and once done run the site to see the page renderings.
    2. Check Pre-requisites here for CMS
  • Setup Machine
    1. Get ready with a Microsoft Windows Server 2012 R2 (x64) and logged into it with your Content Manager Administrator User.
    2. .Ensure that you have installed MS SQL Server 2014 or MS SQL Server 2012 R2 SP2.
    3. Create an MTS User – Preferably with Admin rights else we can choose it to be under normal User group under your domain system. 
  • DB Installation 
    1. Open Windows Powershell by right clicking as choosing “Run As Administrator” 
    2. Navigate to SDL Web8 Installation media path in Powershell – .\SDL_Web_8\Database\mssql
    3. Databases to be Created
      • Content Manager Database 
      • Topology Manager Database 
      • Content Data store/broker Database 
      • Discovery Service Database 
      • Preview Session (XPM) Database 
Note: Last three databases share same schema ie. Content Data Store.
  • Content Manager Installation 
  1. Navigate to the SDL Web Installation Media and run SDLWeb8 executable by right clicking and choosing “Run as administrator” 
  2. Wizard will prompt for selecting the required components. 
  3. Next the setup will shows you all the missing prerequisite which SDL Web must have to work properly – o accept to install these missing prerequisite: 
  4. Once the prerequisites are all installed, you need to provide details of your MTS User: 
  5. Enter the details of Content Manager DB as created in earlier step 
  6. Enter the details of Topology Manager DB as created in earlier step 
  7. Next enter the Environment ID – It is typically to identify your CM instance in case of a scaled out and/or load balanced environment. For a standalone environment, you can leave it default: 
  8. for next step of wizard enter requested information and done with the installation.
Restart your CM Server after installation and enjoy the updated User-Interface.

December 31, 2015

My First DXA Module - JWPlayer - Steps by Step - Content Delivery

In last post, i detailed my experience on the CMS Part of the DXA module. In this post i will explain the CDA part

Visual Studio Solution: In Asp.net MVC each Module is separated by respective Area in the project. There are different ways to set your solution.

  • Use exiting DXA project and create required Area using Mvc ' Add Area..
  • You can use Visual studio extension for DXA to add, required files e.g Registration and Modle classes.
  • I find it easy to add above in existing DXA website, as it make me easy to debug and go ;)
Structure of  this plugin
so when we add new Area all the above folders, except Entity are automatically created along with web.config and JWPlayerAreaRegistration.cs file. 

Step by Step changes:
  1. Create Model class which will be used in the ViewModel and carry the data from component of JWPlayer Schema.
so here i have mapped all fields of schema to this ViewModel.

2.  Create view which will use above model and render the JWplayer Video. the name of view should match with one given in CT's metadata.

3. Update JWPlayerAreaRegisteration.cs so that it inherits  from  Sdl.Web.Mvc.Configuration.BaseAreaRegistration class
and overrides the RegisterAllViewModels method to register above view and view-model in view-registry. see below image , This is again very important step


 Now time to compile and test the module.

You will see following output.

You can see JWPlayer logo on top the the video. this is there as i have not used any valid key for it.

So we are done with the working DXA module step by step. 

Now time to bundle this module using Powershell scripts and submit to the Gallery where people can use and improve it. 

I will also send pull request on GIT to open source the code.  

I have listed out the features  for next version, which i will definitely work in 2016. Stay tuned for that.

Happy new year!!


My First DXA Module - JWPlayer - Steps by Step - CMS

DXA Modules allows us to extend its Functionality via providing new modules. Making separate modules for functionality gives flexibility & re-usability. Independent release of the modules can happen without concerning about the main DXA version and developer can develop their modules and publish at DXA Module repository.
I was very impressed by the DXA modular approach and framework when Bart shown us the slides in last MVP meet. This modular functionality is near similar to WordPress plugin world, where you can download thousands of plugins. Right now downloading in Dxa is not that smooth because nature of the complexity of Tridion vs WordPress and its just start, but i hope SDL will make it smoother in next releases and Alchemy.
btw wordpress also has JWPlayer plugin :)

Each DXA module has primarily two sections.

  1. CMS
  2. CD
CMS Part
  •  Define module's folder structure
  •  DXA has a predefined structure for putting all the building blocks of the module.  
  •  For each new DXA module, we need to create a new folder in Modules Folder
  • The name of folder is usually module name.
  • In Admin folder of module(JWPlayer) , a component of Module Configuration schema is created  
  • Site Manager usually contains Schema and Template to be controlled by Site manager.
  • Settings also have similar folder as in Module but it just contains component etc for defining any settings.

Module Configuration: This is the Mandatory details of the Module

 
  • Module Name: Defines a unique name of this module
  • Version to track any updates in future
  • URL for additional details
  • Active: never used it, but to enable disable the module
  • if  you module is dependent on any other module, so far i have seen only Core here
  • Any settings component is attached here in "Further Configuration section"
  • After setting there is resource section. if you have any resource do attach the resource component there.


i have attached JWPlayer Configuration Component of JWPlayer Configuration Schema, which contains one field for JWPlayer Key.

Schema
I have created another schema "JWPlayer"


This schema will be used by Editor to define the JWPlayer Video components with required Video details and attached to desired page.
Component Template:
I have created a new CT (JWPlayer) to be attached with component of above schema  and following are the metadata settings of it


Entity View Name : Value for Area and View name which will render this CT.

Region Name: Section name of webpage where this CT needs to be rendered. i wanted to render it on home page so used this. but can can be any new region as well.






So we are done with CMS part of the Module. now time to publish.

December 23, 2015

How to use page-type

Continuing from my last post on Page type Demystified Tridion. in which i explored different options in page type creation. In this post i will explore how to use already created page type. 


Enter into Experience Manager and click on new Page in Ribbon-Bar, you will find a new slide-out option on left with list of all page-types available in system you can find-out page type created in the last blog post.

you can see name and description which were entered while creating the page type. so while creating page type i  did not entered the Example page URL, to show the use of that i have entered my blog URL in that now. it should be actual page which is similar to the page being created.

In the Page Types list, if you single click any of the page type. it will start loading Example page on right side in a iframe, to visually show user what kind of pages can be created with it.

You can either double click or select apply to create page from the desired page type. you will see following screen for entering the page details.


Few things to notice on this screen:
  1. Page location: so if you are on a page \home\discovery\discovery.html. and creating a page from page type, it will copy same location in the Page Location textbox by default, though you can change it 
  2. Configure Folder for Components: This option will only be visible if you have defined custom folder path for your component presentation. Check my previous post where we defined the location.
    You can override previously selected location for all the component presentation here, after clicking on Configure Folder for Components.
keep in mind publication will be chosen from the blueprint context defined for this publication (where you are creating this page)

so when we defined page type, we selected folder locations for all components. at that time interface shows folder of that publication only where page type was being created.

But now when component are created , publication is chosen from blueprint context, but folder path(sans publication) is same which you selected while creating page type.

now if that folder does not exist in that context publication(that might be local folder). page creation fails. so you have to little careful here that folder location exists.

After you click on the "Create Page" it may take some time depending upon the no of components on your page. After all the components get created, Xpm will show the page with Sample data which can be changed by editor happily as per need.

Again mentioning only first level of components will be created any component link in sample component will be used as-its. 

December 21, 2015

Page type Demystified Tridion

Page type is very good feature which powers editor to create same type of pages on fly without going into level of components and then assembling the page, but when i started searching for material on internet for it, found very few posts and official document also limited. I am writing this blog to put my understanding for page types i got so far.

Set your Blueprint context right -:
To reach this setting Open , CMS and on top right corner click Hamburger menu -> settings -> Inline editing

We need to define the publication for the pages and components where those should be created in the publication hierarchy.  This is very great feature, you can do this setting for each of your website. e.g you want to create English content in your Content-english publication and Chinese in Content-Chinese folder. so you need to select your website from left panel, where you will select the website/publication where pages needs to be created.


on right side you will select two blueprint Content
  • for Pages - if you want to create pages other than this publication e.g some master publication choose that publication  in "Alternative Blueprint Publication"
  • for Components - if you want your components to be created in different publication which is obvious, please select that master publication here from the drop-down "Alternative Blueprint Publication"

    Now time to create the page type.
Create a new page 
Create a new page and give it name and select PT as process. Now select check-box
"Use this page as PageType"

it will show you two another options as show in below pic.
  •  In page type description give the description, it will show as subtitle of the page type in XPM.
  • Example page URL, so that Editor can see if he use this page type how will my page look after creating, XPMopens this URL in iframe at time of page creation.
After doing above now click on Component Presentations tab and add a new component presentation. ie. Component and Component Template.

now select newly added component presentation on left side, you will observe a new tab after component presentation tab ie. "Page Type Settings"

here we need to set name of the component, folder location of component and behavior.


in page type settings you will observe two Radio
  • Include this Component presentation - Use this settings if you want to include same component on all newly created page. e.g you have shared banner component. which you want to repeat for all the pages. select this option. 
  •  Include.... that contains a copy - Use this setting if you want new component on newly created page. select the folder location and provide a name with placeholder as per requirement. so a copy of the selected component with new tcm-id will be created in above selected location. content for which can be updated by Author in XPM. this is best candidate for product or page specific components.

    Furthermore this location can be changed (if required) during page creation.

    important thing to notice you are giving setting for only component, same component template will be applied which is selected on left side.
Some desired features
  • When a copy of a component is created , any  linked components' copies are not created, so . but you have to create new linked component manually in CMS and then link it in form view. so it makes some time XPM unusable if you have many linked component are used in your component model.
    e.g Creating Carousel is nightmare using page types.
  • No option for setting folder location for metadata linked components, so any linked component in page type metadata will be used as its. no option to create replica and location of that component.
and few more to be added later.

now  we are done with the settings for page types. now time to use this Page-type

December 19, 2015

Comparison of different DXA version.

DXA new versions are being released with quite a good pace, i think each quarter they are releasing new version. so far 1.01, 1.1 and 1.2 are released. Bart & his team doing very remarkable job in it. when i first time used DXA 1.01 there were numbers of bugs in it, but in each version its improving. its making development very rapid.  I am here trying to summarize what each release of DXA brings to table.



DXA 1.01 (STRI)

DXA 1.1

DXA 1.2

DXA 1.3 (not released yet, may change)

Release Date

Sep 2014

Aug 2015

Nov 2015

 Expected (Jan/Feb 2016)
DD4T version1.311.312.02.0

Tridion Version 

SDL Tridion 2013 SP1

SDL Tridion 2013 SP1 HR1

SDL Tridion 2013
 SP1 HR1

SDL Tridion 2013 SP1 HR1 & SDL WEB 8

.net framework

4.5.1

4.5.1

4.5.1

4.5.2

Official Modules
  • Google Analytics
  • Search
- GA
- Search
- Smart Target
- Media Manager
- GA
- Search
- Smart Target
- Media Manager

Asp.net MVC MVC 5 MVC 5 MVC 5 MVC 5

Changes


  • ·Improved support for creating Modules
  • ·Solutions changes and Refactoring of code
  • Better Performance
  • Improvements in handling Media Items.
  • Page Includes as Region
  • No separate installation of Node js required, its included.
  • Html-design splitted into two files , 1 for fixed grunt modules , 2 for app related css, js etc.
  • Updated Syntax for rendering region and markups


December 13, 2015

Donut caching using Outputcache with DXA

Donut caching is the best way to cache an entire web page except for one or more parts of the web page. unfortunately post asp first version asp.net do not provide any good way to implement it.

I required to implement it in my project as i want all CMS pages to be cached except for the dynamic login and other sections. As DXA 1.2 has single method to process pages in Page Controller, and DxaEntity for component presentation. so if you apply OOTB Asp.net Outputcache attribute to it. it will cache entire page including the dynamic sections.
While searching for solution i come across the DevTrends' library which enables Donut caching Asp.net mvc solutions. i downloaded it from NuGet. using "install-package MvcDonutCaching" but could not use as it is because this library Serialize all the parameters passed in htmlAction method.


MvcHtmlString result = htmlHelper.Action(actionName, controllerName, parameters);


Code Change in Library
but problem with this is, the last parameter contains object of DD4T's ComponentPresentation class. so serialization fails while complaining about "no knowledge of this class". so i had to download the Source code of this library and add the reference of "DD4T.ContentModel" and then provided class in question as known type of Serialiser.

public ActionSettingsSerialiser(){_serialiser = new DataContractSerializer(typeof(ActionSettings), new[] { typeof(RouteValueDictionary),typeof(ComponentPresentation)});}

Code Change in DXA Library
Donut Library provides overloads of all methods in Helper.Action method, it provides a additional Boolean parameter which accepts whether to exclude the view from cache or not.
  • Refer the namespace of the library in Sdl.Web.Mvc.Html.HtmlHelperExtensions
  • Add optional parameter in following method.
    - MvcHtmlString DxaEntities(this HtmlHelper htmlHelper, int containerSize = 0, string excludeCache = null)
  • And following changes in  DxaEntity  
  • public static MvcHtmlString DxaEntity(this HtmlHelper htmlHelper, EntityModel entity, int containerSize = 0, string excludeCache=null)
  • bool excludeFromCache = (mvcData.ViewName.ToLower() == (excludeCache!=null?excludeCache.ToLower():string.Empty)); 
  • MvcHtmlString result = htmlHelper.Action(actionName, controllerName, parameters,excludeFromCache)

so i have added a optional parameter in the DxaEntities and DxaEntity Method, if any of the view is required to be excluded from the parent cache, just provide the name of the view.

It will match the viewName if it matches, then true is passed in the HtmlHelper.Action method and exclude this view from the cache.

Change in PageController or you can override the method.
[DonutOutputCache(CacheProfile = "Cache1Hour")]
        public virtual ActionResult Page(string pageUrl) 
web.config settings.
    <caching>
      <outputCache enableOutputCache="true"/>
      <outputCacheSettings>
        <outputCacheProfiles>
          <add name="Cache1Hour" duration="0" location="Server" />
        </outputCacheProfiles>
      </outputCacheSettings>
    </caching>

August 08, 2015

Profiling and Personalization using Target Groups in DXA DD4T

Profiling and Personalization aka P&P is very useful feature of Tridion. User's behavior can be tracked and user can be targeted with set of content.

In this post i am going to detail P&P custom characteristics use with DXA and DD4T. We started with SmartTarget evaluation but due to license cost and hardware requirement for Fredhopper caused us to evaluate this Out of the box feature of Tridion to use with DXA.

P&P provides basic but very useful personalization features. 
  1. Tracking Keys
  2. Custom Characteristics
Tracking Keys: Tracking keys are used for Implicit Personalization. Using these  you can can track interest as user visits various content. This functionality works on the tridion Category/keywords. Editor add the "Activate tracking" tbb  in the page template and add the category for tracking in CT's Tracked Category.  Schema should also be added to the component also. publish the page.
On your presentation side custom code has to be written using WAI to track the activities. 

Custom Characteristics:  CC are  used for Explicit Personalization. User information for targeting can be collected using some form e.g. gender, age, city, country. This information can be persisted in the broker db for further use.

Steps to use CC

Page Template Change

Include dd4t tbb "Add Target Groups" on the page template.

Define TargetGroup : 
  • Right click on folder and select  TargetGroup.
  • Set the characteristics as shown below.














  • TargetGroup can only be assigned to component Presentations. Lets do it & Publish the page.









XML: 
After publishing page, DD4T page xml will contain Condition need under Component-presentation node.

<Page>
.
.
 <ComponentPresentation>
.
<Conditions>
        <Condition d5p1:type="CustomerCharacteristicCondition" xmlns:d5p1="http://www.w3.org/2001/XMLSchema-instance">
          <Negate>false</Negate>
          <Name>city</Name>
          <Operator>Contains</Operator>
          <Value xmlns:q3="http://www.w3.org/2001/XMLSchema" d5p1:type="q3:string">Mumbai</Value>
        </Condition>
        <Condition d5p1:type="CustomerCharacteristicCondition" xmlns:d5p1="http://www.w3.org/2001/XMLSchema-instance">
          <Negate>false</Negate>
          <Name>city</Name>
          <Operator>Contains</Operator>
          <Value xmlns:q4="http://www.w3.org/2001/XMLSchema" d5p1:type="q4:string">Delhi</Value>
        </Condition>
      </Conditions>
    </ComponentPresentation>
.
.
</Page>

Presentation server

Here XML is de-serialized to c# object
Note: Current DD4T 1.31 which is part of latest  DXA has bug , because of that XML-with- -conditions-tag de-serialization fails.As this is fixed in DD4T 2.0 so i used some code from 2.0 version and fixed it.

When user access the website where we have WAI module configured
  • Cookie is generated with USER_ID key. 
  • If you have non-login website this USER_ID is generated automatically by WAI
  • You can write custom logic to update the USER_ID with your website user_id
There is no OOTB code to work on Conditions on DXA/DD4T, so you have to write custom code to remove the component presentation where condition fails.

Example user is not from Delhi or Mumbai. then delete that component presentation. 

 var  waiPage= new WAIPage(page.Id, this.HttpContext.ApplicationInstance.Context);
            CustomerCharacteristics cc= new CustomerCharacteristics(waiPage.User);
            var city= customerCharacteristics.GetValue("city");
            if (string.IsNullOrEmpty(city))
            {
                cc.SetValue("country", "Kolkata");//this city may come from your Geolocation module.

                cc.ExecuteUpdate();
            }                                                                       
           foreach(var cp in page)
            {
                foreach(var condition in cp.Conditions)
                {
                    if (condition is CustomerCharacteristicCondition)
                    {
                        
                        var ccCondition= (CustomerCharacteristicCondition)condition;
                        var node = (XmlNode[])ccCondition.Value;
                        string city= node[2].Value;       
                                    }
//now you can remove the component presentation here whereever conditions does not match.

                }
            }

now updated page is processed further via DXA for generation of views


June 30, 2015

DXA aka STRI - My Tiny step in Tridion (SDL Web) Reference implementation.

What is in name? as told by a Great Author and a famous community Builder

STRI - SDL Tridion Reference Implementation: Tridion development is usually considered complex and time consuming, also there is learning curve understanding bits any bytes of it. so few Tridion MVPs came together and developed this MVC based solution to make Tridion development bit easy and fast. STRI provides lots of modules out of the box,  which  are usually required for most of the sites.

In under-hood it uses DD4T as default, but you can extend and create your own custom framework if any and use it instead. so all the template work which usually take more time, which includes DWT/Razor, C# tbbs etc, can be developed in MVC with ease.

DXA - Everything is same just a rename. so new name is Digital Experience Accelerator

Each individual community framework and modules,used in DXA, should be supported by their respective owner or community (wherever applicable.)

Note: You might be thinking its just an DD4T. as i mentioned above  DD4T is just another module in DXA, but yes big module along with other useful modules and features e.g
  1. Google Analytics
  2. Solr Search using SI4T framework
  3. Language Selector
  4. XPM Ready, Yes your site is XPM ready from start, no longer  phase 2 stuff now :)
  5. Navigation and breadcrumbs
  6. Image Resizing
  7. Responsive Design using bootstrap

...Many more...

sample site comes with lots of modules integrated for reference. just install and diggit.

Download DXA/STRI

December 31, 2014

Different API and Extension points in Tridion CM

Sdl Tridion can be customized at various levels as it provides very rich APIs to extend it. Tridion has different extension points for CM and CD. i will try to cover maximum extension points below.

Content Management

APIs

1) Tom.net: Tom.net is .net based API, it runs and CM machine. it allows to you to interact from CM machine only.  Tom.net provides various methods to be used for Templating, Event System. This is Read/Write API, but write operations are by default off in config.

2) Core Service - Core service is WCF service which expose various APIs to interact with CM system. it provide CRUD methods to operate on various CMS Objects. Main use-case of core-service is when you need to interact with CM machine from different machine other than CM or if you want to integrated CM with some third party system. It was introduced in Tridion 2011 (to replace existing COM based APIs) and still in use. It is also used in Workflows
e.g:  you need to read some Xml and create components in Tridion CM.

3) Anguilla: It is used to extend Content Manager Explorer(CME) user interface. eg. you want to introduce new buttons and new functionality in CME. e.g Custom spell checker, custom publishing, extend paste functionality. It was introduced in Tridion 2011 and still in use.

4) ECL : External Content Library was introduced in Tridion 2013, its very useful and awesome API available in Tridion. It allows to list/integrate external content repositories  third-party content/media in CMS and allow you to use it as native components with little exception. The access point looks just like a normal folder, making it easy to manage.
e.g . User want to see all images of DAM into CM system, want to view You tube or Dailymotion videos in CM interface to use in the components. 

Extension Points:

5) GUI Extensions - Its used to extend/customized the CMS UI. anguilla, JS and .net are used to create a GUI extension.

6) Events: Tridion provides Events as extension point where you can capture particular event and provide some customization. one of the most used use-case is validation of data. so when user save the component, save even can be captured and validate the data, log the data etc.

7) Custom Resolver: A resolver basically read an item from the publishing-queue and returns a list of items to be rendered. Tridion has kept it extensible so if you want to override default resolving behavior.
e.g when a component is resolved, by default all the component that links to this component are also resolved and so on. so it gives very long queue and impact the performance also, so if you want to resolve only this component or level 1 component this can be extended and registered in the TridionContentManager.config file.

8) Custom Page: Custom Pages can be used to perform operations in the Content Manager that are not supported by the default UI(user interface) . e.g, create a Custom Page that talks with the Core Service to automate Page creation. it can also be used to customize dashboard for users.

December 16, 2014

Anchor in Tridion Component links

In Tridion Link Anchor (jump to specific section of the page) is very tricky. there is an out of the box anchor option. let discuss that first.

Anchor OOTB : In component link there is an attribute "Add Anchor"

<tridion:ComponentLink runat="server" PageURI="tcm:85-159563-64" ComponentURI="tcm:85-159309" TemplateURI="tcm:0-0-0" AddAnchor="true" LinkText="internal link test" LinkAttributes=" title= &#34;alt text for link &#34;" TextOnFail="true"/>

when this AddAnchor = true is set. Tridion CD will create anchor for particular components as per their position of the page.

e.g following is a Tridion page sompage.aspx having three components Comp 1 and Comp 2 and Comp 3

------------
Comp 1
---------
Comp 2
---------
Comp 3
---------------

e.g you use comp2 as component link on another page. it will be resolved as somepage.aspx#1
so this is as per the position of the component on page.

another catch is you have to create <a id="1"> on somePage explicitly using your templates. this is not automated.

Custom solution:
As OOTB solution is base on numbers only. if you want to based it on some text e.g #Intro. you need some customization for it.

I have develop & tested this small solution for it.
------------------------------------------------------------------------------------------------------------
namespace  CD.Web.ComponentLink.Extensions
{
    public class ComponentLink : Tridion.ContentDelivery.Web.UI.ComponentLink
    {
        [DefaultValue("None")]
        [Bindable(true)]
        [Category("Appearance")]
        public string AnchorName { get; set; }


        protected override void Render(HtmlTextWriter writer)
        {
            if (HttpContext.Current == null || HttpContext.Current.Application == null)
                return;
            using (var compLink = new Tridion.ContentDelivery.Web.Linking.ComponentLink(new TcmUri(ComponentUri).PublicationId))
            {
             
                var link = compLink.GetLink(PageUri, ComponentUri, TemplateUri, LinkAttributes, LinkText, TextOnFail, AddAnchor);
                link.Anchor = AnchorName;
             
                string linkAsString = link.ToString();
                writer.Write(linkAsString);
                this.RenderChildren(writer);
            }
        }

    }

}
------------------------------------------------------------------------------------------------------


  • Register above custom control in your website's web.config 
  • Update schema to accept the Anchor from Editor
  • Update template code to pass this anchor name as mention below

<Rk:ComponentLink runat="server" PageURI="tcm:85-159563-64" ComponentURI="tcm:85-159309" TemplateURI="tcm:0-0-0" AnchorName="true" AddAnchor="false" LinkText="internal link test" LinkAttributes=" title= &#34;alt text for link &#34;" TextOnFail="true"/>

do post comments if you have any questions.