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.
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 source document itself (for folder-mapped pages, this is the default document)
- The head.html
- The global (and additional) metadata
- The custom headers configuration
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.