Folder Mapping
It’s not uncommon for websites to serve multiple URLs from a single document, displaying dynamic content for large portions of the page without authors having to create each page individually.
Some best practices scenarios where folder mapping is useful:
- Commerce websites generating product pages from a product information API
- Blogs with dynamic listing pages of posts for categories or tags
- For a single-page application, mapping requests to a code-bus resource
AEM handles these cases via a folder mapping in the fstab.yaml
file:
mountpoints:
/: https://mycompany.sharepoint.com/:f:/r/sites/WebsiteProjects/Shared%20Documents/sites/company-site
folders:
# Generate everything on and below /products with the "generic-product"
/products: /generic-product
# Generate everything below /categories/ with the "default-category"
# Note the trailing slash here, which differentiates this from the above example
# and applies the mapping only inside the categories folder
/categories/: /categories/default-category
# Use the given html from the code-bus for everything on and below /app
/app: /spa/index.html
If your site uses the configuration service, you can manage folders in your site configuration. See here for instructions on how to update folders.
Anti-Patterns
Folder mapping should not be used for:
- Sites using a combination of a large number of folder-mapped pages and frequently changing metadata. For such use cases, it is better to provide the content via different methods. Talk to your Adobe contact to learn more.
- Mapping of excessively dynamic or infinite URLs like
/search/<query>
, dynamic search results are better served via query parameters or URL hash property - Generating non-cacheable content like user specific URLs. This can lead to cache pollution and possible security risks if content is unintentionally cached.
Additional Considerations
There are some additional rules applied to bulk metadata for folder mapped pages, see Folder-mapped metadata in the bulk metadata documentation for details.