Today we discuss about Magento 2 set homepage.This tutorial include how to change or set homepage in system configuration program and how to change or set homepage from admin panel system configuration.There are two way to set home page one is from admin panel other is set homepage programmatically. So let start with our example
Set homepage from Admin Panel
Login to admin panel.
Select your desired page from dropdown.
Set homepage from programmatically
Just inject the class \Magento\Config\Model\ResourceModel\Config $_resourceConfig and set value for web/default/cms_home_page to desired page ‘youridentifier’.
$this->_resourceConfig = $_resourceConfig;
$this->_resourceConfig->saveConfig('web/default/cms_home_page', 'youridentifier', 'default', 0);