Friday, 14 December 2012

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

No comments:

Post a comment