The hreflang attribute (also referred to as rel="alternate") tells Google which language you are using on a specific page, so the search engine can serve that result to users searching in that language.
Considering the Magento multi store structure, this module will add the hreflang tag to the pages.
<link rel="alternate" href="http://example.com/en" hreflang="en-us" />
<link rel="alternate" href="http://example.com/pt" hreflang="pt-br" />
- Run
composer require vandersonramos/magento2-hreflangtag
- Run
php bin/magento setup:upgrade
- Run
php bin/magento cache:clean
- Run
composer remove vandersonramos/magento2-hreflangtag