Customize AEM Site output

The AEM Guides supports creating outputs in following formats:

  • AEM Site
  • PDF
  • HTML5
  • EPUB
  • Custom output through DITA-OT

For the AEM Site output, you can assign different design templates with different output tasks. These design templates can render the DITA content in different layouts. For example, you could specify different design templates for internal and external audiences.

You can also use customized DITA Open Toolkit (DITA-OT) plug-ins with the AEM Guides. You can upload these custom DITA-OT plug-ins to generate PDF output in a specific way.

TIP
See the AEM Site publishing section in the Best practices guide for best practices around creating AEM Site output.

Customize design template for generating output

The AEM Guides uses a set of predefined design templates to generate AEM Site output. You can customize the AEM Guides design templates to generate the output that conforms to your corporate branding. A design template is a collection of various styles (CSS), scripts (both server- and client-side), resources (images, logos, and other assets), and JCR nodes that tie all these resources together. A design template can be as simple as a single server-side script with just a couple of JCR nodes, or a complex combination of styles, resources, and JCR nodes. Design templates are used by AEM Guides publishing subsystem while generating AEM Site output and they control the structure, look and feel of the generated output.

There is no restriction as to where the design template resources should be located on the server, but they are usually logically organized as per their function. For example, the default template has all its JavaScript and CSS files stored under /etc/designs/fmdita/clientlibs/siteoutput/default folder. Wherever these files are located, they are linked together by a collection of JCR nodes. Together, these JCR nodes and the files constitute the whole design template.

The default design template shipped with the AEM Guides allows you to customize the landing, topic, and search page components. You can make a copy of the default design and the corresponding reference templates and specify different components to generate the desired output.

Perform the following steps to specify your own design template to use for AEM Site output generation:

  1. Use the Package Manager to download the default design template from the following location:

    /libs/fmdita/config/templates

  2. Create a copy of the downloaded files at the following location in your Cloud Manager’s Git repository:

    /apps/fmdita/config/templates

  3. You must also download and copy the templates referenced from the default template node. The referenced templates are placed under:

    /libs/fmdita/templates/default/cqtemplates

    The AEM Guides design template properties are described in the following table.

    PropertyDescription
    landingPageTemplate, searchPageTemplate, topicPageTemplate, shadowPageTemplateSpecify the cq:Template node for these corresponding pages (landing, search, and topic). By default the cq:Template node for these pages can be found in /libs/fmdita/templates/default/cqtemplates node. This node defines the structure and properties of the landing, search, and topic pages.
    The shadowPageTemplate is used to optimize the chunked content. You need to set the value of this property to: fmdita/templates/default/cqtemplates/shadowpage
    Note: You must specify a value for the topicPageTemplate. The landingPageTemplate and searchPageTemplate are optional properties. If you do not want the search and landing pages to generate, do not specify these properties.
    titleA descriptive name of your design template.
    topicContentNodeThe location of the node that will contain the DITA content in a topic page. Path is relative to the topic page.
    topicHeadNodeThe location of the node that will contain the head values (or metadata) derived from the DITA content. Path is relative to topic page.
    tocNodeThe location of the node that will contain the TOC. Path is relative to the landing page or destination path.
    basePathPropThe property name for storing the path of the root of the published site.
    indexPathPropThe property name for storing the path of the landing/index page of the published site.
    pdfPathPropThe property name for storing the topic PDF path, if topic PDF generation is enabled.
    pdfTypePropThe property name for storing the type of the PDF generation. Currently this property always contains “Topic”.
    searchPathPropThe property name for storing the path of the search page, if the template includes a search page.
    siteTitlePropThe property name for storing the title of the site being published. This title is usually the same as the title of the map being published.
    sourcePathPropThe property name for storing the path of the source DITA topic for the current page.
    tocPathPropThe property name for storing the path of the TOC root for the published site.
NOTE
After creating a custom design template node, you must update the Design option in the AEM Site output presets to use the custom design template node.

For more information, see Creating your first Adobe Experience Manager website and The Basics of developing your own website on AEM.

Use document title for generating AEM site output

When generating AEM Site output, the way URLs are generated play an important role in the discoverability of your content. In case you are using UUID-based file names, generating URLs based on UUID of your files would not be search friendly. As an Administrator or Publisher, you have the control on how you want to generate the URLs for your AEM Site output. AEM Guides gives you a configuration through which you can choose to generate the URLs of AEM Site output using the file’s title rather than the UUID-based file names. By default, for UUID-based file systems, this option is turned ON. This implied that when you generate AEM Site output for UUID-based file systems, the file’s titles are used to generate the URLs and not the UUIDs of the files.

NOTE
You can further configure rules to allow only a set of character in the URLs of an AEM Site output. For more details, see Configure filename sanitization rules for creating topics and publishing AEM Site output.

Use the instructions given in Configuration overrides to create the configuration file. In the configuration file, provide the following (property) details to configure the URLs generation in AEM Site output:

PIDProperty KeyProperty Value
com.adobe.fmdita.config.ConfigManageraemsite.pagetitleBoolean (true/false). In case you want to generate output using the page title, then set this property to true. By default, it is set to use the file name.
Default value: false

Configure the URL of the AEM Site output to use the document title

You can use the document titles in the URL of the AEM Site output. If the filename doesn’t exist or contains all special characters, you can configure the system to replace the special characters with a separator in the URL of the AEM Site output. You can also configure it to replace them with the first child topic’s name.

To configure the page names, perform the following steps:

  1. Use the instructions given in Configuration overrides to create the configuration file.
  2. In the configuration file, provide the following (property) details to configure the page names for the topics.
PIDProperty KeyProperty Value
com.adobe.fmdita.common.SanitizeNodeNamenodename.systemDefinedPageNameBoolean (true/false). Default value: false

For example, if the @navtitle in <topichead> has all special characters and you set the aemsite.pagetitle property to true, then by default, it uses a separator. If you set the nodename.systemDefinedPageName property to true, it shows the first child topic’s name.

Configure filename sanitization rules for creating topics and publishing output in AEM Sites and other formats

As an administrator, you can define a list of valid special characters allowed in filenames, which eventually form the URL of an AEM Site output. In earlier releases, users were allowed to define filenames containing special characters such as @, $, >, and more. These special characters resulted in encoded URL on generation of AEM Site pages.

Starting with 3.8 release, configurations have been added to define a list of special characters that are allowed in the filenames. By default, the valid filename configuration contains “a-z A-Z 0-9 - _”. This implies that while creating a file, you can have any special character in the file’s title, but internally it will get replaced with a hyphen (-) in the filename. For example, you can have the file’s title as Introduction 1 or Introduction@1, the corresponding filename generated for both these cases would be Introduction-1.

When you define a list of valid characters, remember that these characters “*/:[\]|#%{}?&<>"/+” and a space will always be replaced with a hyphen (-).

NOTE
If you do not configure the valid special characters list, the file creation process might give you some unexpected results.

Use the instructions given in Configuration overrides to create the configuration file. In the configuration file, provide the following (property) details to configure the valid special characters in filenames and AEM Site output:

PIDProperty KeyProperty Value
com.adobe.fmdita.common.SanitizeNodeNameImplaemsite.DisallowedFileNameCharsEnsure that the property is set to '<>`@$. You can add more special characters to this list.
NOTE
The above configuration applies to all output formats. This means that when generating a PDF, HTML, or custom output, the final output will follow the configured filename sanitization rules.

You can also configure the other properties such as use lower case in filenames, separator to handle invalid characters, and maximum number of characters allowed in the filenames. To configure these properties, add the following key value pairs in the configuration file:

Property KeyProperty Value
nodename.uselowerBoolean (true/false).
Default value: true
nodename.separatorAny character.
Default value: _ (underscore)
nodename.maxlengthInteger value.
Default value: 50