Wednesday 26 December 2012

Copying DAM images from one AEM to another in AEM


We should be very careful when packaging up DAM assets and moving them from one AEM instance to another,  because the package install on the target system will delete anything, from the folder on the target system, which is not in the package.  This would also automatically trigger a deactivation of those images from the publish servers (assuming the target is an author). 

Below are some recommended methods.


Step 1 - retrieve the images safely

Login to CRX Content Explorer of the originating system (in this case the AEM Publish)

Create a 'safe' folder in the CRX repository at /tmp/images2copy_safe

Copy the image nodes from their original location in to the 'safe' folder.

Login to CRX Package Manager of the originating system

Create a new package called "images2copy" with the filter of the 'safe' folder /tmp/images2copy_safe

Build the package

Download the package



Step 2 - upload, install and move the images in the author


Login to CRX Package Manager of the target system (in this case the AEM Author)

Upload the package "images2copy" to the target system

Test install the package - check that it will store the images in /tmp/images2copy_safe and NOT in /content/dam/...

Install the package

Login to CRX Content Explorer of the target system

Move each of the image nodes from the 'safe' folder /tmp/images2copy_safe to their correct location in the DAM /content/dam/...

Verify that you can access each image via the DAM Admin interface



Clean up


Delete the "images2copy" package from the publish server

Delete the "images2copy" package from the author server

Delete the "/tmp/images2copy_safe" node from the publish server

Delete the "/tmp/images2copy_safe" node from the author server

Finally, share the list of images with the content team and ask them to activate them or de-activate them as appropriate.

Tuesday 18 December 2012

SEO with Day CQ


Search Engine Optimization mainly defines the power of a website and rest is in creative content. SEO is not a separate process which can be started once we finish the site implementation. This about SEO before you imagine about the UI, bcz it helps to reach more people.

CQ supports SEO through below methods:


  • CQ helps to create search engine friendly URL's
  • Customizable templates
  • Image components have <alt> tags by default in CQ. so always use better names for files.
  • Paragraph formatting with various tags in RTE component
  • Distinguished page property elements to better describe your content

Be very careful to follow below items which helps to improve the SEO through CQ

  • Remember about SEO before any design
  • Never create bad/broken links
  • Use text for all rich media assets.
  • Always use Compression techniques.
  • Reference of XML sitemap in robots.txt
  • Every page should have a unique page title.
  •  All error page should someway link to home page.
  • Always use 301 - permanent redirect, this enables better SEO loops.
  • If there is a business need to have more than one URL, always use 301 permanent-redirect to redirect from one url to another url.
  • Always use Absolute URLs (complete) rather than Relative URLs.
  • All nodes in content hierarchy should be lowercase as CQ uses content hierarchy to reach to a page.
  • If the CMS automatically creates a new URL for every time a page changes, it would automatically remove the old URL and update in the XML sitemap with the new one. In addition, the old URL would be permanently redirected (301) to the new URL.
  • When creating an XML sitemap, ensure it is dynamic, always updated one.
  • Heading tags should be used on each page, highlighting key terms as headings. Particularly the use of the H1 tag.
  • Use breadcrumb as much as possible if requirements permit.
  • Use the rel=prev and rel=next pagination tags on pages that are paginated, ensure a proper link flow.

Friday 14 December 2012

AEM Coding standards

Good AEM projects are backed by the coding standards.

A developer must always be worried about the quality of his code. Let us see why the code quality is important?

>    80% of the lifetime cost of a piece of software goes to maintenance.
>    Hardly any software is maintained for its whole life by the original author.
>    Code conventions improve the readability of the software, allowing engineers to understand new code more quickly and thoroughly.
>    If you ship your source code as a product, you need to make sure it is as well packaged and clean as any other product you create.

Code Conventions
Thus, everyone writing software must confirm to the code conventions in any technologies. Recommended way to approach such a challenge would be to:
>    Reuse : The template roughly defines page structure (navigation elements, panels, and so on), which is further fine-tuned by its design (CSS, graphics). So reuse an existing template to create a new type of page.
>    Parsys/iparsys: Use the paragraph system (parsys/iparsys) on the new pages.
>    Authorize: Define access right to the Design mode of the paragraph systems, so that only authorized people (usually the administrator) can change them.
>    Proper definitions: Define the components allowed in the given paragraph system so that editors can then place the required components on the page.
>    Roles based: Editors add and configure the allowed components, on the pages they are responsible for, to deliver the requested functionality (information) to the business.

The developers of AEM/CQ based systems should therefore use:

>    Templates and access control to paragraph system design for uniformity and brand protection
>    Paragraph system including its configuration options for flexibility.

General rules for developers in AEM projects:
>    Minimum count: Keep the number of templates low - as low as the number of fundamentally different page structures on the web sites.
>    Provide flexibility: Provide necessary flexibility and configuration capabilities to your custom components.
>    Use Parsys where ever possible: Maximize use of the power and flexibility of AEM paragraph system - the parsys & iparsys components.

Methods to copy and paste the component including its content from one content page to another content(actually content paragraphs) in CQ

Below methods can be used to copy-paste content paragraphs,

    Copy/Paste: You can copy (duplicate) or move a paragraph within the same Web page. The "Edit Bar" has icons to select a paragraph and copy or move it.

    Inheritance: Instead of using the "parsys" (Paragraph System) component to create new content paragraphs, you can use "iparsys". The purpose of "iparsys" is to "inherit" content paragraphs from the parent page. The way it works is that on the first page containing "iparsys" you create paragraphs using components, just as you would do with the "parsys" component. Every new child page you create will show an "iparsys" bar and the same content as on the parent page. On child pages you have the option to "turn iparsys off" and then repopulate the paragraphs with different content, that will be inherited by child pages of the current page.
  
 Content Sharing: There is a possibility to share the same piece of content among Web pages. To do so you create a "Design Dialog" instead of the (edit) Dialog. The Design Dialog will not save the content to the Web page, but to what is known as a "Design Page". The design pages are located under /etc/designs. For example, you can create a new design page (with the Design template) under /etc/designs/{project}, etc. Then you assign the design page via Page Properties to the Web page and use the Design Dialog to edit content. When you create a new child page, it automatically will "inherit" the same design page as the parent and hence also share the content stored on the design page.  
  
   Reusable Content  also called Lookup Content: This is a common idea you notice in cases like, using the DAM. You create the content in a place outside the Web site. For the Web page you create a "reference" component, that you use to select the path (or paragraph) to the "reusable content". The component script will then read and display the "reusable content". It's to some degree similar like the "design page". Selecting an asset from DAM follows the same principles. The benefit is that if you edit the reusable content, all pages referencing it will show the new content automatically. You will not even have to activate the referencing pages, because by activating the "reusable content page" the cache gets invalidated (in fact, that's the whole purpose of having the CQ Dispatcher! Invalidating cache will make sure that pages referencing content will get flushed on first new request).


By above method adoption we can,

    a) Try to avoid dev interactions when content changes (e.g. if you hardcode content in a template and want to change that)
    b) Make authoring as simple as possible. By sharing, inheriting or reusing content you usually edit the content once to update multiple pages and paragraphs

Tuesday 11 December 2012

Search And Promote Query for Proximity Search with latitude & longitude


Say you have +30.4613-084.6139, then below query will fetch the output.

S&P URL?sp_q_location_1=%2b30.4613-084.6139&sp_x_1=latlong&sp_q_max_1=100&sp_s=latlong_proximity
[Replace '+' with URL encoding character '%2b']

Search And Promote Query for Logical OR operation


Say you have a document with title Countries, ho to find for existence of two words say India, United States.

 S&P URL?sp_q_exact_1=India|United+States&sp_x_1=Countries