Add function to check parent elements for ID when routing to metadata
page