Question

How is it possible to create a simple symlink component that lets users create symlinks to other existing pages?

Answer, Resolution

In order to build a simple symlink component that allows for creating a symlink page, a simple page component with following code is sufficient:

com.day.cq.wcm.api.WCMMode mode = com.day.cq.wcm.api.WCMMode.DISABLED.toRequest(request);
try {
    %><sling:include path="/content/geometrixx/en/products" /><%
} catch (Exception e) {
    log.error("Exception while including target", e);
} finally {
    mode.toRequest(request);
}

In above example, the content page located at /content/geometrixx/en/products will be displayed as a hard-coded reference. The symlink page itself is displayed in read-only mode, the edit functionality is disabled.

Please note that this is just an example showing the basic principle. What is missing for example is a dialog which allows users to choose the symlink target and so on.

Applies to

CQ5.x

Za ta izdelek je bila izdana neprenosljiva licenca za priznanje avtorstva, nekomercialno uporabo in skupno rabo pod enakimi pogoji 3.0  Objav v storitvah Twitter™ in Facebook ne urejajo pogoji pogodbe Creative Commons.

Pravna obvestila   |   Pravilnik o zasebnosti v spletu