Home > widget-integration > FilterService > parseCollectionPath

FilterService.parseCollectionPath() method

Parses collection path from URL and updates app configuration.

Extracts collection handle and optional tag from URL path, retrieves collection ID from storage, and updates TAEAppConfig with collection context. Handles both /collections/handle and /collections/handle/tag URLs.

Signature:

parseCollectionPath(): void;

Returns:

void

Remarks

Updates generalSettings with: - collection_id: Retrieved from storage by handle - collection_handle: Extracted from URL - collection_tags: Array with tag if present in URL, undefined otherwise

Example

Override to handle custom collection URL structures:

parseCollectionPath() {
  const pathname = window.location.pathname;
  if (pathname.startsWith('/custom-collections/')) {
    // Handle custom URL structure
    const [, , handle, tag] = pathname.split('/');
    this.setCollectionContext(handle, tag);
  } else {
    super.parseCollectionPath();
  }
}