Showing posts with label DXA module. Show all posts
Showing posts with label DXA module. Show all posts

Tuesday 28 February 2017

ElasticSearch Module in DXA


In my last two blogs we have discussed how to create components by consuming the data from Elasticsearch and then how to index data in Elasticsearch when publishing components.

Today,We are going to discuss and create Elasticsearch module in DXA which will have following features .DXA Modules allows us to extend its Functionality via creating new modules. Here we can create new modules which gives us flexibility & re-usability.

Features and Advantages :- 

  • Free text search .
  • Tag based filtering.
  • Lighting fast response powered by Elasticsearch.
  • Pagination and sorting based on fields.
  • Article detail page.

In order to use the Elasticsearch module we need to setup the storage extension and Elasticsearch which we already discussed in my previous blog here.
Once that is done using Elasticsearch module in DXA we can search the content from Elasticsearch and render on DXA based application .

Let's discuss the CMS part first.
Elasticsearch Module structure 


  1. Define module's folder structure
  2. DXA gives us predefined structure where we can keep all the building blocks of the module.
  3. For each new DXA module, we need to create a new folder in Modules Folder
  4. The name of folder is usually module name.

Next is creating the Schema and Component Templates. I have create dynamic components and index them in Elasticsearch and render on the DXA based web application.


  1. Publish all the dynamic components and index them in Elastic.
  2. Create new area in you DXA web Application.
    DXA Module
  3. We can call Elastic RESTFul API to get the data.
  4. Data will be returned in the form of JSON.
  5. Create model to deserialize the JSON.
  6. Let's search for the text SDL.
  7. Result can be further filtered based on tagging as well.
  8. Compare the search result with the data index in Elastic
    Elastic Search RESTFul API

.Happy Coding and Keep Sharing !!!

Sunday 30 October 2016

News and Article Module In DXA

Why Fresh Content is Critical for Your Website?
  1. Keep Your Audience Informed and Updated
  2. Fresh Content Increases Your Authority Potential
  3. More Content, More Keywords
  4. Google Loves Frequent Updates
So, add an article, an image or just make some change on your site to get noticed. The easiest and most effective way to stay fresh is to add a blog on your site and continue to add articles that will get noticed by your viewers.

Today,We are going to discuss and create News and Article module in DXA which will have following features  .DXA Modules allows us to extend its Functionality via creating new modules. Here we can create new modules which gives us flexibility & re-usability.
  1. Article searching
  2. Tag based filtering 
  3. Article list and detail articles 
  4. Author details page 
Let's discuss the CMS part first.
CMS structure
  1. Define module's folder structure
  2. DXA gives us predefined structure where we can putting all the building blocks of the module.
  3. For each new DXA module, we need to create a new folder in Modules Folder
  4. The name of folder is usually module name.
Next is creating the Schema and Component Templates. I have used dynamic components which render on the landing page as a list of articles and with details page link.

You need to create dynamic CT for the list of articles

Dynamic Component Template
Publish all the Dynamic Article components .
Dynamic N&M Components

To read dynamic Components we need to query Broker DB.
Get Article Dynamic Components ID

Build Criteria based on you will get the data from Broker DB
Now ,Let's see the Content Delivery 
New Area called NewsAndArticle in DXA 
Create new area in you DXA web Application. Here i have created Models,and helper class to get the data from broker using Broker Queries.

Register your views in NewsAndArticleAreaRegistration.cs . Once done now let run the application .

1. News and Article Landing Page
Landing Page
Here you can see list of articles are rendering from Broker DB using broker query .Using this view we can search an article ,filter by category and view the author details.

2. Search will search in the intro Text in metadata.
Search result
3. Filter your result based on Tags click on tag.
Result based on tags

4. Click on read more link for Article Details page 
Article details page
5. Author Details Page .
Author page

Happy coding and keep sharing !!!!