Linking to Theme Images and Assets in Magento 2
Magento 2 serves theme assets from generated static paths, so hard-coding URLs breaks easily. Use these helpers instead.
The helpers
{{view url=''}} // In Block and CMS Pages
$block->getViewFileUrl() // in Phtml or on php
Use the directive in CMS pages and blocks, and $block->getViewFileUrl('images/logo.svg') in templates. Both resolve the correct path for the current theme and locale.
Need a second pair of eyes on this? Our team handles Magento development every week. See how we can help.