Customizing the Importer
Learn how to customize the AEM Importer to maximize efficiency and accuracy during a site migration to document authoring with Edge Delivery Services.
Transcript
How to Consume a Markdown File Out of the box, the importer should be able to consume any page and output a markdown file out of it. Some parts like the navigation, the header or the footer should not appear in all the doc files. The first element of the docs should be a heading one. Some data are metadata that can be stored in a metadata block. Such a rule is very straightforward to implement. It is usually a set of DOM operations. Create new, move or delete DOM elements. In your import.js transformation file, you can implement two modes. One input slash one output. You must implement two methods, transform DOM and generate document path. In transform DOM you implement your transformation rules and return the DOM element that needs to be transformed to markdown. In generate document path you return a path that describes the document being transformed. You can define and filter the page name and folder structure in which the document should be stored. One input slash multiple outputs. You must implement the transform method and in this method you can implement your transformation rules and return an array of pairs where element is a DOM DOM element that needs to be converted to markdown. Note on generated paths. The AEM URL space is pretty restricted, lowercase, only latin characters, only hyphens, no.html and the recommendation given to authors is to maintain directory and document names following the exact same restrictions in SharePoint or Google Drive to have a one-to-one mapping between the path plus file and its URL. It makes their life so much easier. When importing a site, you will encounter a lot of various fancy URLs. The generate document path function allows you to control the document target path. It is a best practice to apply the Web Importer dot file utils dot sanitize path helper method to all paths as provided in the provided default import dot js file. Note when working on an import with the import workbench tool, the import dot js file is hot reloaded and the import process is launched automatically Each time you modify the file, this allows to immediately see the impact of your changes. This hot reload behavior is not available when working with the import bulk tool. This is to avoid the risk of relaunching the full import if you touch your import dot js file while importing 1k or more pages.
recommendation-more-help
bb44cebf-d964-4e3c-b64e-ce882243fe4d