I'm trying to retrieve the current CMS page id in Magento2. Below is the code I used for Magento1.x which obviously doesnt work anymore. But I can not get my head around how to do this for Magento2.
if (Mage::app()->getFrontController()->getRequest()->getRouteName() == 'cms') {
$_pageId = Mage::getBlockSingleton('cms/page')->getPage()->getPageId();
}
Using the registry as shown below wont work.
$this->_coreRegistry->registry('cms_page')->getId()