Full action name for CMS home is cms_page_view
.
In order to get CMS page identifier , you need to inject
to __construct()
then using those you get current page identifier
You want to identifier of cms page then you can get by below code:
/**
* Store manager
*
* @var \Magento\Store\Model\StoreManagerInterface
*/
protected $_storeManager;
/**
* @var \Magento\Cms\Model\Page
*/
protected $_page;
public function __construct(
...
\Magento\Cms\Model\Page $page,
\Magento\Store\Model\StoreManagerInterface $storeManager,
.....
) {
...
$this->_page = $page;
$this->_storeManager = $storeManager;
..
}
public function getPageDetails(){
$pageId = $request->getParam('page_id', $this->getRequest()->getParam('id', false));
$this->_page->setStoreId($this->_storeManager->getStore()->getId());
if ($this->_page->load($pageId)) {
echo $this->_page->getIdentifier();
}
}