How to get a page url from a *.phtml template in Magento 2?

- Fire development, Magento 2

Magento 2 Development

To get a page url from a *.phtml template in Magento 2, you can call the\Magento\Framework\View\Element\AbstractBlock::getUrl() method:

'

 

or

The core example looks as follows:

Source

More tips from the Cookbook

'