Helper/Data.php
public function generateDynamicUrl()
    {
        $website = $this->_request->getParam('website', false);

        //set website url for the default store id
        $website = ($website) ? $this->storeManager->getWebsite($website) : 0;

        $defaultGroup = $this->storeManager->getWebsite($website)
            ->getDefaultGroup();

        if (!$defaultGroup) {
            return $this->storeManager->getStore()->getBaseUrl(
                \Magento\Framework\UrlInterface::URL_TYPE_WEB
            );
        }

        //base url
        $baseUrl = $this->storeManager->getStore(
            $defaultGroup->getDefaultStore()
        )->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_LINK);

        return $baseUrl;
    }
public function generateDynamicUrl()
    {
        $website = $this->_request->getParam('website', false);

        //set website url for the default store id
        $website = ($website) ? $this->storeManager->getWebsite($website) : 0;

        $defaultGroup = $this->storeManager->getWebsite($website)
            ->getDefaultGroup();

        if (!$defaultGroup) {
            return $this->storeManager->getStore()->getBaseUrl(
                \Magento\Framework\UrlInterface::URL_TYPE_WEB
            );
        }

        //base url
        $baseUrl = $this->storeManager->getStore(
            $defaultGroup->getDefaultStore()
        )->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_LINK);

        return $baseUrl;
    }
public function generateDynamicUrl ( ) { $ website = $ this -> _request -> getParam ( 'website' , false ) ; //set website url for the default store id $ website = ( $ website ) ? $ this -> storeManager -> getWebsite ( $ website ) : 0 ; $ defaultGroup = $ this -> storeManager -> getWebsite ( $ website ) -> getDefaultGroup ( ) ; if ( ! $ defaultGroup ) { return $ this -> storeManager -> getStore ( ) -> getBaseUrl ( \ Magento \ Framework \ UrlInterface :: URL_TYPE_WEB ) ; } //base url $ baseUrl = $ this -> storeManager -> getStore ( $ defaultGroup -> getDefaultStore ( ) ) -> getBaseUrl ( \ Magento \ Framework \ UrlInterface :: URL_TYPE_LINK ) ; return $ baseUrl ; }
Generate the baseurl for the default store
dynamic content will be displayed.

@return string
Generate the baseurl for the default store dynamic content will be displayed .