Magento2 - Is it possible to get base url in a static block?
-
04-10-2020 - |
Question
I'm trying to get the base url in a static block.
I've tried the following code:
<a href="{{base url=""}}../business">
I knew this wasn't going to work because it needs <?php ?>
around it.
Is there an alternative way to get the base url in a static block through the backend?
Solution
You can get base url in static block like this.
<a href="{{store direct_url="business"}}">Your link</a>
OTHER TIPS
You can get it by {{config path="web/unsecure/base_url"}}
and If you want to append another URL then you can do like
<a href="{{config path="web/unsecure/base_url"}}test213/32"> test </a>
If you want secure base URL then you can get it by
{{config path="web/secure/base_url"}}
You can add store URL in static block:
<a href="{{store direct_url='identifier'}}">Your link</a>
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange