Question: I would like to add the magento website name to the top header beside the language switcher. 

```
Magento_Store/templates/switch/languages.phtml

```

I can get the id by using, 

```
echo $block->getCurrentWebsiteId();

```

How do I get the website name?

Answer: 
```
public function __construct(

        \Magento\Store\Model\Website $websiteModel
    ..........
)
{
    $this->_websiteModel = $websiteModel;
}

public function getWebsiteName($websiteId)
    {
        $collection = $this->_websiteModel->load($websiteId,'website_id');
        return $collection->getName();
    }

```
in your block file, you can use below code :

```
public function __construct(
    \Magento\Store\Model\ResourceModel\Website\CollectionFactory $websiteCollectionFactory,
    ..........
)
{
    $this->_websiteCollectionFactory = $websiteCollectionFactory;
}

public function getWebsiteName()
{
    //$websiteId is your current website id
    $collection = $this->_websiteCollectionFactory->create()->load($websiteId,'website_id');
    $websiteData = $collection->getData();
    $websiteName = $websiteData[0]['name'];
    return $websiteName;
}

```

You can now call `getWebsiteName` in your phtml file to display the website name.