Setting different title and meta title for a page

This is how I managed to get different Meta Title and Page Heading. I have below code In my block class:

public function __construct(
    \Magento\Framework\View\Element\Template\Context $context,
    \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
    \Magento\Framework\View\Page\Config $pageConfig,
    $data = array()
) {
    $this->_scopeConfig = $scopeConfig; 
    $this->_pageConfig = $pageConfig;   

    parent::__construct($context, $data);
}

 /**
 * Prepare global layout
 *
 * @return $this
 */
protected function _prepareLayout()
{
    $this->_pageConfig->addBodyClass('advance-sitemap');

    if($this->getSeoTitle())
        $this->_pageConfig->getTitle()->set('Meta Title');

    if($this->getMetaKeywords())        
        $this->_pageConfig->setKeywords('Meta Keywords');

    if($this->getMetaDescription())         
        $this->_pageConfig->setDescription('Meta Description');

    $pageMainTitle = $this->getLayout()->getBlock('page.main.title');
    if ($pageMainTitle) {
        $pageMainTitle->setPageTitle('Page Heading Title');
    }

    return parent::_prepareLayout();
}

[EDIT by OP]
You can set the page title from the controller also, like this:

$resultPage = $this->resultPageFactory->create();
$pageMainTitle = $resultPage->getLayout()->getBlock('page.main.title');
if ($pageMainTitle && $pageMainTitle instanceof \Magento\Theme\Block\Html\Title) {
    $pageMainTitle->setPageTitle('Page title here');
}
//rest of the code here.