Wednesday 29 November 2017

Setting up Dispatcher on Mac OS X

Namastey, 

Setting up dispatcher is one of the most common thing we do in AEM projects. Sometimes developers face issues in configuring it on Mac OS X. 

You can follow below steps and get basic dispatcher setup done. 

Step 1: Install Apache Server on your machine.Verify the version by running.

sudo httpd -version

Step 2: Download Dispatcher Module and sample files as per OS and apache version

Step 3: Extract the downloaded dispatcher module file and copy file "dispatcher-apache<x.y>-<rel-nr>.so" to directory /usr/libexec/apache2/
You can rename the copied file to mod_dispatcher.so 

Step 4: Open httpd.conf from /private/etc/apache2/

Step 5: Add following configurations after last load module. ( it should be around line 170 in default in httpd.conf).

LoadModule dispatcher_module libexec/apache2/mod_dispatcher.so

<IfModule disp_apache2.c>
  DispatcherConfig /etc/apache2/conf/dispatcher.any
  DispatcherLog    /etc/apache2/logs/dispatcher.log
  DispatcherLogLevel 3
  DispatcherDeclineRoot 0
  DispatcherUseProcessedURL 0
  DispatcherPassError 0
  DispatcherKeepAliveTimeout 60
</IfModule>

<Directory />
  <IfModule disp_apache2.c>
    SetHandler dispatcher-handler
    ModMimeUsePathInfo On
  </IfModule>

  Options FollowSymLinks
  AllowOverride None
</Directory>

Step 6: Copy dispatcher.any from downloaded dispatcher module and paste it to /etc/apache2/conf/dispatcher.any

Step 7: Open dispatcher.any and find docroot in the configurations and change the location to match document root of httpd.conf

/docroot "/Library/WebServer/Documents"

Step 8: Run following command to verify configurations. You should get Synatax OK in response .
sudo apachectl start
sudo apachectl configtest

Step 9: Restart apache 
sudo apachectl restart

Step 10: Start author instance on port 4502 and navigate to http://localhost:80 and it should redirect you to author instance.
You can find cached file at "/Library/WebServer/Documents"

For any issues you can tail apache and dispatcher log
/private/var/log/apache2/
/etc/apache2/logs/dispatcher.log

Note: This is basic configuration for author instance using out of the box files available.For more details refer adobe doc [0][1]


Dhanywaad



Friday 17 November 2017

Apache Webserver on Mac

Quick handy command and details for Apache Webserver on Mac. 

Start Apache
sudo apachectl start

Stop Apache
sudo apachectl stop

Restart Apache 
sudo apachectl restart

Configuration Test
sudp apachectl configtest

Apache Installation Location
/usr/libexec/apache2/

Apache Conf Location
/private/etc/apache2/

Default Doc location
/Library/Webserver/Documents/

Error File location
/private/var/log/apache2/

Host File location
/etc/hosts

You can also get some of these details by running following command
httpd -V

Note: Details from Mac OS X El Capitan / Sierra

Friday 8 September 2017

Experience Fragments Vs Content Fragment

Namastey & Welcome !

It's quite a common questions these days, What is the difference between Experience Fragments and Content Fragments ?

Its Simple !

A Fragment is useful because we can reuse them on multiple pages and
whenever required you can edit them from one single location.

To differentiate between CF and XF it's important to understand who is the target user.
Experience Fragment is mainly for authors
And Content Fragment is mainly for content writers.



Usually content writers ( e.g. news editors, magazine authors ) are more concerned of writing textual content and provide associated images.

They may worry about creating variations of content for different channel like mobile, print,tablet etc or different variation of content like teasers, summary etc.

Once the content is created, Authors may use the content on AEM Page as authors are more responsible for presenting content in appropriate layout

EXPERIENCE FRAGMENT

Lets take an example, You have contact information section on your AEM page which contains a few custom components like address, phone number and email details and a map view of address. This set of component is a meaningful experience in itself.

You can create this set of component as Experience fragment and then you can use this experience fragment on any number of the pages.

Please let me know if you have any other question.

Dhanywad !

Wednesday 14 June 2017

Javascript Use API Example


  • HTL ( previously known as Sightly ) focuses on separation of concerns. 
  • UI Developers shouldn't worry about back-end logic as they use to be with JSPs,
  • With HTL back-end logic should come from Java or Javascript.
  • As a HTL Developer , you are provided with Use API  you can simply call logic by data-sly-use operator.
  • Syntax: 
    • data-sly-use.objectName =" JAVA class  /Java script name "
  • An object is created and that object can be used for accessing properties returned by Java or javascript.



Sunday 21 May 2017

AEM Static Template Vs Editable Template

Namastey, 

Templates are basis of AEM page. Author can create a page using a template . These templates define basic structure of the page, what components can be used on the page and design of the page.

With AEM 6.2 , Editable Templates were introduced to reduce dependency of authors on developers.
In AEM 6.3 Editable Templates are quite a mature and powerful feature.

AEM Static Templates 

  • Static templates are created by developers ( It defines page rendering component , availability of template for authors to create the page ) 
  • Stored in /apps directory of CRX
  • Once a page is created using templates, after that if we make any change in static template it wouldn't affect the page.
  • Design mode is available for applying Page design.

AEM Editable Templates

  • Editable Templates can be created by template-authors ( non-developers ).
  • Stored in /conf directory of CRX
  • Pages created using editable templates would affect if any changes on editable templates are done.
  • Page design is controlled by content and page policies.Hence no design mode available.


Dhanywad.



Create AEM Templates - Everything about AEM Templates

Namastey,

Defining Templates

  • A template is the basis of a page.
  • A Template is like a stencil or frame or blueprint which is used to create multiple pages with same page structure. 
  • Template defines which components can be added on the created page.
  • All the pages having same template is going to have same design.

Steps to create a template 

Step 1. Open CRXDE Lite ( http://localhost:4502/crx/de)
Step 2. Go to your project folder or create one   ( E.g  / apps/training )
Step 3. Create a folder to organise all templates ( E.g templates ) 
Step 4. Right click and select "create template "


Label : Name of the node
Title  : Name of the template
ResourceType : Location of page component which will be used to render the page
Ranking : Order of the template which will be visible to Author.





















Step 5 .Click Next and Enter allowedParents : /content(./*)? 
Step 6. Click Next , Next & Finish.

A template node will be created of type cq:Template with some properties that we have added until Step 6.

Restrict usage of template 
You may want to restrict usage of template by author , For Example 

  • A product page should never be created as home page.
  • A homepage should never be created under products page.
  • A page can only be created under path /content/training/en/.


allowedPath : Path of a page that is allowed to be based on this template.
allowedParents : Path of a template that is allowed to be a parent of this template.
allowedChildren : Path of a template that is allowed to be a child of this template.

Some common regex for restrictions.

  • /content : Restrict creation of page only under content node.
  • /content(./*)? :Restrict creation under content node and it's child node
  • /content/training : Restrict creation of page under /content/training node only , Template will not be available at /content node or for child nodes of training.
  • /content/training(./*)? : Restrict creation of page under training node under content and child node.


Adding Thumbnail to Template

Thumbnail of template is defined by thumbnail.png node inside template node.
To show a thumbnail for page/template , either you can create a new thumbnail node for template node and add images of different renditions OR you can easily generate thumbnail for a page and use the node structure for template. 


Step 1. Select the page created by the template
Step 2. Click on view properties in Touch UI
Step 3. Go to Thumbnail tab and upload an image or generate a preview from page content.

Go to CRXDe and go to the page which you have created , You will find node named 'file' containing dam:thumbnails. 














Step 4. Copy file node and paste it at /apps/training/templates/basicartile/jcr:content
Step 5. Rename file node to thumbnail.png so that AEM can recognize this node as thumbnail as shown below.
















Now create page wizard will show you a template with thumbnail and  the pages created with the template as well.

















Dhanywad !


Basic Sling Model Exporter

/* Open a page which is having component /apps/project/components/page/page /content/project/en/jcr:content.model.json Don't miss...