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:

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:

Folder-mapped Metadata

If the site has folder mapping configured, the metadata files within that folder will apply to all pages for that mapping. For example, if /templates/ is folder-mapped to /templates/default, metadata in /templates/default/metadata.xlsx will be applied to all pages below /templates/ if the URL pattern matches.

Last-Modified Date

Changes to folder-mapped metadata are not reflected in the last-modified HTTP response header of pages within the mapped scope. By default, the date of the last modification of the default document will be used. If you rely on that header value to be updated based on metadata changes, which may be desirable for SEO or SEM purposes, you can influence* it by adding an explicit last-modified column. This allows you to set the desired date string or timestamp for select rows only while leaving the others unchanged. We recommend the ISO date format to ensure it’s both human-readable and timezone-safe. .

Example:

URL			Last-modified
/products/product1	2024-11-21T00:00:00Z
/products/product2	2024-11-20T00:00:00Z
/products/product3	2024-11-19T00:00:00Z

* Note: The actual last-modified HTTP response header is calculated based on the modification times of the contributing resources to the response:

The most recent modification time of those resources will be used. This means that the last-modified value provided might not be the final header value if, for example, the head.html is younger.

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.