Workspace Filter in AEM

The filter is used to define what parts of the JCR repository will be inport or export during package installation or un-installation.

The filter.xml file is present under META-INF/vault. filter.xml has below structure. It consist a set of filter elements which is having a mandatory root attribute and optional include and exclude child elements.

<?xml version="1.0" encoding="UTF-8"?>
<workspaceFilter version="1.0">
    <filter root="/apps/techiearchive">
        <exclude pattern="/apps/techiearchive/install" />
    </filter>
    <filter root="/etc/clientlibs/techiearchive"/>
    <filter root="/etc/notification/email/html/techiearchive"/>
</workspaceFilter>

Filter elements

The filter elements are independent of each other and define include and exclude patters for subtrees. The root of a subtree is defined by the root attribute, which must be an absolute path.

The filter element can have an optional mode attribute which specified the import mode used when importing content. the following values are possible:

replace

This is the normal behavior. Existing content is replaced completely by the imported content, i.e. is overridden or deleted accordingly.

merge

Existing content is not modified, i.e. only new content is added and none is deleted or modified.

update

Existing content is updated, new content is added and none is deleted.

AEM Log files

  1. Access.log: It capture maximum information including IP, username, time stamp, request method, token information, request protocol, response code, which page we have requested and browser details
  2. Request.log: It has few information like- time stamp, which page we have requested, request method, response code and how much time to get a responded.
  3. History.log: This log basically stored the information, which pages we have visited and what purpose (eg: VIEW, EDIT etc) with time stamp and by which user.
  4. Error.log: This log is basically used for debugging the server side code. It shows the error, info, warn and debug logs for all the projects.
  5. Stdout.log: This log file shows the information about AEM startup details (eg: which time AEM has started, which port, runmode is used etc).
  6. Stderr.log: This log file is used to show if any error occurred during AEM startup.

Create a content fragment and it’s variations in AEM

What is content fragments?

Content fragment has been introduced in AEM6.2. It allow us to create, design and page independent content. It’s store as an Asset so, it is managing through Asset console. It’s allow to use in multiple location or channels eg: mobile site, desktop site etc. Content Fragments do not contain any layout and design. Content fragments are not available in the classic UI.

Since AEM6.4 it can deliver in JSON format, using Sling Model export capabilities in AEM core components. AEM Content Fragments can be used to describe and manage structured content. Structured content is defined in models that can contain a variety of content types; including text, numerical data, boolean, date and time, and more. Learn more about content fragment.

Types of Content Fragments

Content fragments are available in two types.

  • Simple fragments
    • It does not have customized structure, It contains only text and images.
  • Fragment contains structure contents
    • Based on content fragment model. we can customize the structure.

Variation

Variations are copy of master content fragment and can be edit the content inside variation. It is using for specific channel and authoring as per requirement. eg: Mobile site variation or email variation.

Create a content fragment

To create a content fragment perform below steps:

  1. Go to AEM Start> Assets > Files
  2. Or click to open AEM asset view http://localhost:4502/assets.html/content/dam
  3. Create a folder “Demo Folder”
Demo Folder

4. Now inside the “Demo Folder” create content fragment

create content fragment

5. Select the “Simple Fragment” template and click the Next.

6. Specify “Demo content fragment” as the title and “Example of content fragment” as the description and click create.

Content fragment

Edit text in content fragment

Select Demo content fragment and click edit the fragment. Then add text inside the fragment and click save.

content fragment text

Create a variation

We can create multiple variations of channel specific which will use in different AEM application.

Let see how to create variation. There are few steps:

  1. Click on create variation in left and provide name for variation. eg: Mobile view
    Mobile view variation

  2. Now add text content specific to mobile view and click save.
    Mobile view content

SQL2 Query | AEM

Fetch users node

SELECT * FROM [rep:User] As user WHERE ISDESCENDANTNODE(user, ‘/home/users’) AND [rep:authorizableId] <> ‘anonymous’ AND [jcr:primaryType] <> ‘rep:SystemUser’ AND [rep:authorizableId] NOT LIKE ‘%@%’ ORDER BY [rep:authorizableId] ASC

Search node having specific resourceType

SELECT * FROM [nt:unstructured] As node WHERE ISDESCENDANTNODE(node, ‘/content’) and [sling:resourceType] LIKE  ‘%components/page/site’

Find the pages which does not have [cq:tags] property

select * from [cq:PageContent] as page where ISDESCENDANTNODE(page,’/content/corporate/news’) AND page.[cq:tags] is null

Find the page and its node who has matching component

select * from [nt:unstructured] as page where ISDESCENDANTNODE(page, ‘/content’) and [sling:resourceType] like ‘%components/content/accordion’

Find the projects/Website name where the specific component is exist

select * from [cq:Component] as node where ISDESCENDANTNODE(node, ‘/apps’) and name() =’accordion’

Find the template name where particular component is used

select * from [nt:unstructured] as page where ISDESCENDANTNODE(page, ‘/apps’) and [sling:resourceType] like ‘%accordion’

Find all templates in apps folder

select * from [cq:Template] as page where ISDESCENDANTNODE(page, ‘/apps’)

Find all pages which created by specific template

select * from [cq:PageContent] as page where ISDESCENDANTNODE(page, ‘/content/corporate’) and [cq:template] =’/apps/corporate/templates/home-page’