Question

In our theme we have a static block for the links we have in our footer. We have three blocks with Account, info and social media.

At the moment everything is hard coded with relative link paths to store pages & absolute link paths to the social media pages.

I'm wondering what is the best way to link to store pages, and know you can use cms directives

For instance there are these links for customer account pages.

<a href="{{store url='customer/account'}}">My Account</a>
<a href="{{store url='customer/address'}}">My Address</a>
<a href="{{store url='wishlist'}}">My Wishlist</a>

Why would you use this method rather than a relative path? i.e.

<a href="customer/account">My Account</a>

Is there another way to link to the customer/account page? without using the customer/account keywords?

Also why would you use something like this for a CMS page?

<a href="{{store direct_url="contact"}}">Contact Us</a>

is there a better way to link to a cms page from within a static block or another cms page?

Was it helpful?

Solution

The way you are doing it is correct.
The {{store}} directive should know how to generate the correct link even if you change the customer module route name (that is currently customer). If you change it to client (see here how) <a href="{{store url='customer/account'}}">My Account</a> will still generate the correct url.
For CMS pages you should use the widget approach so it won't be important if the page changes.

{{widget type="cms/widget_page_link" anchor_text="some text here" title="some title here" template="cms/widget/link/link_block.phtml" page_id="52"}} 
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top