Add support for replacing templates via simple path matching