{"id":5723,"date":"2019-01-21T13:56:09","date_gmt":"2019-01-21T08:26:09","guid":{"rendered":"\/?p=5723"},"modified":"2019-08-22T16:50:42","modified_gmt":"2019-08-22T11:20:42","slug":"sling-dynamic-include-sdi","status":"publish","type":"post","link":"https:\/\/www.argildx.us\/technology\/sling-dynamic-include-sdi\/","title":{"rendered":"Sling Dynamic Include (SDI): Dynamically Include Page Components"},"content":{"rendered":"

In CQ or AEM, most of the pages remain static. Hence, caching of the pages is very useful with dispatchers or any other available AEM plugins\/connectors. Imagine a scenario where homepage of news agency must show the hot news which is different for different regions, however, because of caching it is displaying the same news in all the regions. Strange! To rescue from these, live scenarios, the application may require certain elements\/components of the page to be dynamically included. In AEM, Sling Dynamic Include (SDI) provides this functionality.<\/p>\n

 <\/p>\n

Let\u2019s elaborate SDI integration with AEM 6.4, Dynamic Include 3.0.0 and Dispatcher 2.4.<\/p>\n

 <\/p>\n

Please note that Step 1 and Step 2 need to be performed on publish instance. <\/strong><\/h6>\n

 <\/p>\n

Step 1:<\/strong><\/h6>\n

\u00a0<\/strong><\/p>\n

Install Sling Dynamic Include Bundle using the following steps:<\/p>\n

    \n
  1. Download<\/a> the Dynamic Include bundle.<\/li>\n
  2. Open the bundles using http:\/\/<host>:<port>\/system\/console\/bundles<\/li>\n
  3. Click on install\/update button in the right corner of the screen<\/li>\n<\/ol>\n

    \"\"\u00a0 \u00a0 \u00a0 4. Check the Start Bundle checkbox and browse the location where the bundle is downloaded and Click on install\/update button<\/p>\n

    \"\"<\/p>\n

    Once the installation of the bundle is completed, verify it by searching Dynamic Include. It should be in an active state.<\/p>\n

    \"\"<\/p>\n

    Step 2:<\/strong><\/h6>\n

     <\/p>\n

    After installation of the SDI bundle, the next step is to configure the component to be dynamically included.<\/p>\n

    <?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<jcr:root xmlns:sling=\"http:\/\/sling.apache.org\/jcr\/sling\/1.0\"xmlns:cq=\"http:\/\/www.day.com\/jcr\/cq\/1.0\"\r\n    xmlns:jcr=\"http:\/\/www.jcp.org\/jcr\/1.0\"xmlns:nt=\"http:\/\/www.jcp.org\/jcr\/nt\/1.0\"\r\n    jcr:primaryType=\"sling:OsgiConfig\"\r\n    include-filter.config.enabled=\"{Boolean}true\"\r\n    include-filter.config.path=\"\/content\"\r\n    include-filter.config.resource-types=\"[my-app\/components\/content\/dynamic_included_component]\"\r\n    include-filter.config.include-type=\"SSI\"\r\n    include-filter.config.add_comment=\"{Boolean}false\"\r\n    include-filter.config.selector=\"nocache\"\r\n    include-filter.config.ttl=\"\"\r\n    include-filter.config.required_header=\"Server-Agent=Communique-Dispatcher\"\r\n    include-filter.config.ignoreUrlParams=\"[]\"\r\n    include-filter.config.rewrite=\"{Boolean}true\"\r\n\/>\r\n<\/pre>\n

    Please find below the brief description of each OSGI config used above:<\/p>\n